mirror of
https://github.com/assenzostefano/class-website.git
synced 2025-06-06 00:39:12 +02:00
Add comments on the code and add a simple slash commands
This commit is contained in:
@ -24,6 +24,7 @@ async def on_ready():
|
||||
print('We have logged in as {0.user}'.format(bot))
|
||||
bot.loop.create_task(orario())
|
||||
|
||||
# Search on MongoDB the subject and send a message on Discord if the subject is found
|
||||
@tasks.loop(seconds=1)
|
||||
async def orario():
|
||||
documents = collection.find()
|
||||
@ -37,4 +38,8 @@ async def orario():
|
||||
channel = bot.get_channel(1063753802638954519)
|
||||
await channel.send(f"Day: {day}, Hour school: {i}, Subject found: {subject['Subject']} at index: {i}")
|
||||
|
||||
@bot.slash_command(name="first_slash", guild_ids=['1063753799874912337']) #Add the guild ids in which the slash command will appear. If it should be in all, remove the argument, but note that it will take some time (up to an hour) to register the command if it's for all guilds.
|
||||
async def first_slash(ctx):
|
||||
await ctx.respond("You executed the slash command!")
|
||||
|
||||
bot.run(DISCORD_TOKEN)
|
Reference in New Issue
Block a user