mirror of https://github.com/miaowware/qrm2.git
Added task to refresh the activity
- It's like `chron`, but in discord!
This commit is contained in:
parent
0d7dc3853c
commit
5989f123e8
16
main.py
16
main.py
|
@ -9,7 +9,7 @@ qrm, a bot for Discord
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
import discord.ext.commands as commands
|
from discord.ext import commands, tasks
|
||||||
|
|
||||||
import info
|
import info
|
||||||
|
|
||||||
|
@ -48,14 +48,28 @@ bot = commands.Bot(command_prefix=opt.prefix, description=info.description, help
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
print(f"Logged in as: {bot.user} - {bot.user.id}")
|
print(f"Logged in as: {bot.user} - {bot.user.id}")
|
||||||
print("------")
|
print("------")
|
||||||
|
|
||||||
|
|
||||||
|
# --- Tasks ---
|
||||||
|
|
||||||
|
@tasks.loop(minutes=5)
|
||||||
|
async def _ensure_activity():
|
||||||
await bot.change_presence(activity=discord.Game(name="with lids on 7.200"))
|
await bot.change_presence(activity=discord.Game(name="with lids on 7.200"))
|
||||||
|
|
||||||
|
|
||||||
|
@_ensure_activity.before_loop
|
||||||
|
async def _before_ensure_activity():
|
||||||
|
await bot.wait_until_ready()
|
||||||
|
|
||||||
|
|
||||||
# --- Run ---
|
# --- Run ---
|
||||||
|
|
||||||
bot.add_cog(GlobalSettings(bot))
|
bot.add_cog(GlobalSettings(bot))
|
||||||
bot.load_extension("cogs.infocog")
|
bot.load_extension("cogs.infocog")
|
||||||
|
|
||||||
|
_ensure_activity.start()
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
bot.run(keys.discord_token)
|
bot.run(keys.discord_token)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue