mirror of
https://github.com/NovaOSS/nova-cord.git
synced 2024-11-25 23:53:57 +01:00
Compare commits
No commits in common. "151c9cda779d01f2c95324db09cf3e57d7403492" and "c22fe673bab71147bdb6cb4c615215654f4001dc" have entirely different histories.
151c9cda77
...
c22fe673ba
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -8,8 +8,7 @@
|
||||||
"**/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,9 +128,29 @@ 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