mirror of
https://github.com/NovaOSS/nova-cord.git
synced 2024-11-25 16:43:58 +01:00
Compare commits
2 commits
c22fe673ba
...
151c9cda77
Author | SHA1 | Date | |
---|---|---|---|
151c9cda77 | |||
cafb05ac5d |
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -8,7 +8,8 @@
|
||||||
"**/Thumbs.db": true,
|
"**/Thumbs.db": true,
|
||||||
"**/__pycache__": true,
|
"**/__pycache__": true,
|
||||||
"**/.vscode": true,
|
"**/.vscode": true,
|
||||||
"**/*.map": true
|
"**/*.map": true,
|
||||||
|
"**/*.css.map": true
|
||||||
},
|
},
|
||||||
"hide-files.files": []
|
"hide-files.files": []
|
||||||
}
|
}
|
20
cord/bot.py
20
cord/bot.py
|
@ -128,29 +128,9 @@ async def music(interaction: nextcord.Interaction):
|
||||||
async def resetkey(interaction: nextcord.Interaction):
|
async def resetkey(interaction: nextcord.Interaction):
|
||||||
return await accounts.reset_key(interaction)
|
return await accounts.reset_key(interaction)
|
||||||
|
|
||||||
async def status_update():
|
|
||||||
guild = bot.get_guild(int(os.getenv('DISCORD_GUILD')))
|
|
||||||
members = guild.members
|
|
||||||
|
|
||||||
await bot.change_presence(
|
|
||||||
activity=nextcord.Activity(
|
|
||||||
type=nextcord.ActivityType.watching,
|
|
||||||
name=f'{len(members)} members'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
async def loop_status_update():
|
|
||||||
while True:
|
|
||||||
await status_update()
|
|
||||||
await nextcord.utils.sleep_until(datetime.datetime.now() + datetime.timedelta(minutes=1))
|
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
print(f'Online as {bot.user} (ID: {bot.user.id})')
|
print(f'Online as {bot.user} (ID: {bot.user.id})')
|
||||||
|
|
||||||
await api.start(bot)
|
await api.start(bot)
|
||||||
|
|
||||||
# display status as watching + discord guild member count and update every minute
|
|
||||||
bot.loop.create_task(loop_status_update())
|
|
||||||
|
|
||||||
bot.run(os.getenv('DISCORD_TOKEN'))
|
bot.run(os.getenv('DISCORD_TOKEN'))
|
||||||
|
|
Loading…
Reference in a new issue