Advertisement
Guest User

Untitled

a guest
Jan 18th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. import discord
  2. import os
  3. from asyncio import sleep
  4. from time import time
  5.  
  6. client = discord.Client(self_bot=True)
  7. bumping = False
  8. disboard = 321165645490421760
  9.  
  10.  
  11. class Bump:
  12. def __init__(self):
  13. self.start = 0
  14. self.stop = 0
  15. self.minutes = 0
  16.  
  17.  
  18. Bumping = Bump()
  19.  
  20.  
  21. async def bump(ctx, seconds):
  22. bumping = True
  23. Bumping.start = round(time())
  24. Bumping.stop = round(Bumping.start) + seconds
  25. Bumping.minutes = int((Bumping.stop - Bumping.start)/60)
  26.  
  27. await ctx.channel.send("Bumping in **{}** minutes".format(Bumping.minutes))
  28. await sleep(seconds)
  29. await ctx.channel.send("!disboard bump")
  30.  
  31. bumping = False
  32. Bumping.start = 0
  33. Bumping.stop = 0
  34. Bumping.minutes = 0
  35.  
  36.  
  37. @client.event
  38. async def on_connect():
  39. print("[!] User: {}".format(client.user.name))
  40. print("[!] ID: {}".format(client.user.id))
  41. print(round(time()))
  42.  
  43.  
  44. @client.event
  45. async def on_message(ctx):
  46. seconds = 0
  47. if ctx.author.id == disboard:
  48. msg = ctx.content.split()
  49. for word in msg:
  50. if "**" in word:
  51. seconds = int(word.strip("*")) * 60
  52. if not bumping:
  53. await bump(ctx, seconds)
  54. elif ctx.author.id != client.user.id and ctx.content == "!a":
  55. if Bumping.start > 0:
  56. seconds = int((Bumping.stop - time())/60)
  57. await ctx.channel.send("**{}** minutes until the next bump".format(seconds))
  58. else:
  59. await ctx.channel.send("Welp")
  60.  
  61. token = os.environ.get("DISCORD_BOT_SECRET")
  62. client.run(token)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement