Skip to content

Code in discord module

gitesthuman edited this page Jan 21, 2023 · 8 revisions

Files:

init.py:

  • load(): loads nextcord cogs
  • unloads(): unloads nextcord cogs
  • bot_run()(): starts basic bot configuration like setting commands, establishing connection to the database and setting crucial variables
  • on_command_error(): handles errors

Classes:

Messager:

contains static methods to manage sending, editing and deleting messages on discord

  • send_message(channel_id, content): sends message to the channel
    • params:
      • channel_id: id of the channel
      • content: content of the message
    • returns: None
  • send_dm_message(user_id, content) send private message to the user
    • params:
      • user_id: discord user id
      • content: content of the message
      • embed(optional): discord embed
      • view(optional): nextcord View
    • returns: None
  • edit_message(channel_id, message_id new_content): edit the message
    • params:
      • channel_id: id of the channel
      • message_id: id of the message
      • new_content: new content of the message
    • returns: None

MessageTemplates:

defines message templates, used mainly with discord embeds

CommandCreate:

handles /create command

CommandJoin:

handles /join command

CommandStart:

handles /start command