mirror of
https://github.com/assenzostefano/class-website.git
synced 2025-02-10 15:10:36 +01:00
Add comments on the code and add a simple slash commands
This commit is contained in:
parent
d07dbac7f5
commit
f58b8a06c6
@ -24,6 +24,7 @@ async def on_ready():
|
|||||||
print('We have logged in as {0.user}'.format(bot))
|
print('We have logged in as {0.user}'.format(bot))
|
||||||
bot.loop.create_task(orario())
|
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)
|
@tasks.loop(seconds=1)
|
||||||
async def orario():
|
async def orario():
|
||||||
documents = collection.find()
|
documents = collection.find()
|
||||||
@ -37,4 +38,8 @@ async def orario():
|
|||||||
channel = bot.get_channel(1063753802638954519)
|
channel = bot.get_channel(1063753802638954519)
|
||||||
await channel.send(f"Day: {day}, Hour school: {i}, Subject found: {subject['Subject']} at index: {i}")
|
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)
|
bot.run(DISCORD_TOKEN)
|
Loading…
x
Reference in New Issue
Block a user