API Reference

Messages

display(msg)

Display a message to the user through the current window.

Parameters:msg (string) – The message to display.
Return type:none
send(msg)

Send a message to the user specified by the currently open conversation.

Parameters:msg (string) – The message to display.
Return type:none

State

get_nick()

Return the user’s current nickname.

Return type:string
get_status()

Return a string representing the user’s current status. Can be either “online”, “away”, or “busy”.

Return type:string
get_status_message()

Return the user’s current status message.

Return type:string
get_all_friends()

Return a list of all the user’s friends.

Return type:list of (string, string) tuples containing the nickname followed by their public key

Commands

execute(command, class)

Executes the given command. The API exports three constants for the class parameter; GLOBAL_COMMAND, CHAT_COMMAND, and GROUPCHAT_COMMAND.

Parameters:
  • command (string) – The command to execute.
  • class (int) – The class of the command.
Return type:

none

register(command, help, callback)

Register a callback to be executed whenever command is run. The callback function will be called with one argument, a list of arguments from when the user calls the command.

Parameters:
  • command (string) – The command to listen for.
  • help (string) – A description of the command to be shown in the help menu.
  • callback (callable) – The function to be called.
Return type:

none