Bot

The main module that runs the bot.

Contains owner commands to load and unload cogs, basic logging, and command prefix checks.

bot.discord_log(content=None, embed=None)[source]

Sends message to log channel defined in config.

Parameters:
  • content – The plain text to send.
  • embed – The rich embed for the content to send.
bot.log(content=None, embed=None)[source]

The non-async version of bot.discord_log().

Parameters:
  • content – The plain text to send.
  • embed – The rich embed for the content to send.
bot.message_owner(content=None, embed=None)[source]

The non-async version of bot.pm_owner().

Parameters:
  • content – The plain text to send.
  • embed – The rich embed for the content to send.
bot.on_command_error(ctx, error)[source]

Called when an error through a command occurs. Common instances are handled appropriately.

If error is not handled, the error is raised.

Parameters:
  • ctx – The invocation context.
  • error – The command error.
bot.on_message(ctx)[source]

Called whenever a message is sent to a server the bot is watching.

The message is first checked to see if a bot.prefix() is used. If it is, it will check the utils.fjclasses.chatroom_command() for the proper response. If no response is found, process_command() is called.

Parameters:ctx – The invocation context.
bot.on_ready()[source]

Called when the client is done preparing the data received from Discord.

Stores the datetime the bot started as an attribute.

bot.pm_owner(content=None, embed=None)[source]

Sends private message to owner defined in config.

Parameters:
  • content – The plain text to send.
  • embed – The rich embed for the content to send.
bot.prefix(bot, ctx)[source]

Returns the command prefix defined by a guild from database.

If it does not exist, it inserts record with default command prefix defined in config.
Parameters:
  • bot – The Discord Bot.
  • ctx – The invocation context.
Returns:

The guild’s command prefix.