Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. import discord
  2. import asyncio
  3.  
  4. class MyClient(discord.Client):
  5. def __init__(self, *args, **kwargs):
  6. super().__init__(*args, **kwargs)
  7.  
  8. # create the background task and run it in the background
  9. self.bg_task = self.loop.create_task(self.my_background_task())
  10.  
  11. async def on_ready(self):
  12. print('Logged in as')
  13. print(self.user.name)
  14. print(self.user.id)
  15. print('------')
  16.  
  17. async def my_background_task(self):
  18. await self.wait_until_ready()
  19. arbyfat = "<@103609603291369472>"
  20. channel = self.get_channel() # channel ID goes here
  21. while not self.is_closed():
  22. await channel.send(arbyfat)
  23. await asyncio.sleep(30) # task runs every 30 seconds
  24.  
  25.  
  26. client = MyClient()
  27. client.run('token')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement