Skip to content

Instantly share code, notes, and snippets.

@LucasCoderT
Created June 18, 2018 17:38
Show Gist options
  • Save LucasCoderT/fe87a14789411e2c7e7319d2efd9d55a to your computer and use it in GitHub Desktop.
Save LucasCoderT/fe87a14789411e2c7e7319d2efd9d55a to your computer and use it in GitHub Desktop.
import asyncio
import discord
client = discord.Client()
async def my_background_task():
await client.wait_until_ready()
counter = 0
channel = client.get_channel(123456) # channel ID goes here
while not client.is_closed():
counter += 1
await channel.send(counter)
await asyncio.sleep(60) # task runs every 60 seconds
client.loop.create_task(my_background_task())
client.run("token")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment