Skip to content

The DevSoc discord server's python bot. Created by Emi. Previously maintained by Peter. Now maintained by Jay

Notifications You must be signed in to change notification settings

NTUDevSoc/Discord-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DevSoc Discord Bot

A repository containing the DevSoc discord server's python bot.

Originally Created by @emiipo Previously maintained/updated by @petelampy

Maintained/updated by @devj4y

Adding a command

To add a command either do it in general.py or make a new cog(class with its own listeners and commands):

Adding it in commands.py:

@commands.command #Register the command with the bot.
async def command(self, ctx, arg): #Define the command name.
  await ctx.send(arg) #Execute the command. In this case we send the argument passed back to the user.
  • A command must always have at least one parameter, ctx, which is the Context as the first one.
  • The command is triggered using prefix+command. The current prefix is . so the command would be .command.

Making a new cog:

  • Make a new file or a class in commands.py
  • If making a new file don't forget this import:
from discord.ext import commands
  • Set up the cog, make sure it has init:
class Cog_Name: #Setup the cog.
  def __init__(self, bot):
    self.bot = bot #If you don't have this the commands won't work as they won't be able to get ctx(context).
  • Write your commands the same way as in general.py
  • Don't forget to add this at the end:
def setup(bot):
  bot.add_cog(Cog_Name(bot))

More on commands: here

API Documentation

The documentation for the API can be found here

Requirements

About

The DevSoc discord server's python bot. Created by Emi. Previously maintained by Peter. Now maintained by Jay

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages