Testing out looping status

pull/8/head
sgoudham 4 years ago
parent 6f1832b52d
commit 4747c36b4c

@ -96,13 +96,6 @@ if __name__ == '__main__':
client.load_extension(ext) client.load_extension(ext)
# Bot ping command in milliseconds
@client.command(name="ping", aliases=["Ping"])
async def _ping(ctx):
"""Sends the latency of the bot (ms)"""
await ctx.send(f'Pong! `{round(client.latency * 1000)}ms`')
# Bot prefix command that returns the prefix or updates it # Bot prefix command that returns the prefix or updates it
@client.command(name="prefix", aliases=["Prefix"]) @client.command(name="prefix", aliases=["Prefix"])
@guild_only() @guild_only()
@ -138,8 +131,8 @@ async def on_message(message):
await client.process_commands(message) await client.process_commands(message)
# Choose a random status if client.is_ready():
looping_statuses = cycle( looping_statuses = cycle(
[ [
discord.Activity( discord.Activity(
type=discord.ActivityType.watching, type=discord.ActivityType.watching,
@ -152,16 +145,15 @@ looping_statuses = cycle(
name=f"Hamothy Program | {get_version()}"), name=f"Hamothy Program | {get_version()}"),
discord.Game(name=f"~help | {get_version()}") discord.Game(name=f"~help | {get_version()}")
] ]
) )
@tasks.loop(seconds=180.0, reconnect=True) @tasks.loop(seconds=5, reconnect=True)
async def change_status(): async def change_status():
"""Creating Custom Statuses as a Background Task""" """Creating Custom Statuses as a Background Task"""
# Waiting for the bot to ready # Waiting for the bot to ready
await client.wait_until_ready() await client.wait_until_ready()
# Display the next status in the loop # Display the next status in the loop
await client.change_presence(activity=next(looping_statuses)) await client.change_presence(activity=next(looping_statuses))

Loading…
Cancel
Save