YorKnEz

Untitled

Apr 19th, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 KB | None | 0 0
  1. import discord
  2. from discord.ext import commands
  3. import random
  4. import urllib3
  5. import asyncio
  6. from itertools import cycle
  7.  
  8. #id = 527109606422347807
  9. TOKEN = 'NzAxMTM4NTA2MTg1MTc5Mjcw.Xptivg.1x9TN826eUr_PgjdOQKfFddn47M'
  10.  
  11. client = commands.Bot(command_prefix='.')
  12.  
  13.  
  14. async def remove_role(user):
  15. await asyncio.sleep(15 * 60)
  16.  
  17. id = client.get_guild(527109606422347807)
  18. role = discord.utils.get(id.roles, name='👨‍❤️‍👨Gay')
  19.  
  20. await user.remove_roles(role)
  21. print('Success!')
  22.  
  23.  
  24. @client.event
  25. async def on_ready():
  26. id = client.get_guild(527109606422347807)
  27. await client.change_presence(status=discord.Status.online, activity=discord.CustomActivity(name=''))
  28. print('Bot is ready.')
  29. await id.text_channels[0].send('*bip-boop* Ready to go. *bip-boop*')
  30.  
  31.  
  32. @client.event
  33. async def on_message(message):
  34. print(f'{message.author.name} has sent a message')
  35. if message.content == '.whosucks':
  36. await message.delete()
  37. await client.process_commands(message)
  38.  
  39.  
  40. @client.command()
  41. async def test(ctx):
  42. await ctx.send('test')
  43.  
  44.  
  45. @client.command()
  46. async def whosucks(ctx):
  47. def randomUser():
  48. return client.users[random.randint(0, len(client.users)-1)]
  49.  
  50. allowedNames = ['YorKnEz', 'Moog', 'ÆŇĐŘĒŪČÆ', 'InsertNameHere', 'SHUTY14', 'Costin', 'genesisxyz']
  51.  
  52. userThatSucks = randomUser()
  53.  
  54. while userThatSucks.name not in allowedNames or userThatSucks.name == ctx.message.author.name:
  55. userThatSucks = randomUser()
  56.  
  57. await ctx.send(f'{userThatSucks.mention} sucks.')
  58.  
  59.  
  60. @client.command()
  61. async def fact(ctx):
  62. http = urllib3.PoolManager()
  63. r = http.request('GET', 'http://randomfactgenerator.net/')
  64. #index = r.data.index('<div id=\'z\'>') + len('<div id=\'z\'>')
  65. fact = str(r.data)[2162:]
  66. fact = fact[:fact.index('<')]
  67.  
  68. superFact = 'Pala e gay'
  69. factChance = random.randint(0, 100000)
  70.  
  71. if factChance == 1403:
  72. await ctx.send(superFact)
  73. else:
  74. await ctx.send(fact)
  75.  
  76.  
  77. @client.command()
  78. async def guessnumber(ctx, min = 1, max = 100):
  79. number = random.randint(int(min), int(max))
  80.  
  81. turnCount = 5
  82.  
  83. await ctx.send(f'Your game started! Pick a number between {min} and {max}!!! (Lose if you\'re gay)')
  84.  
  85. while turnCount:
  86. guess = await client.wait_for('message')
  87.  
  88. if guess.author.name != ctx.author.name:
  89. await ctx.send(f'Let {ctx.author.name} play!')
  90. elif guess.author.name == ctx.author.name and not guess.content.isnumeric():
  91. await ctx.send(f'Invalid format! Choose a number between {min} and {max}.')
  92. elif guess.author.name == ctx.author.name and int(min) <= int(guess.content) <= int(max):
  93. if str(number) == guess.content:
  94. if 6 - turnCount == 1:
  95. await ctx.send(f'You guessed the number! In only 1 try! Damn!')
  96. else:
  97. await ctx.send(f'You guessed the number! In only {6 - turnCount} tries!')
  98. turnCount = 1
  99. else:
  100. if turnCount == 1:
  101. id = client.get_guild(527109606422347807)
  102. role = discord.utils.get(id.roles, name = '👨‍❤️‍👨Gay')
  103.  
  104. await ctx.author.add_roles(role)
  105. client.loop.create_task(remove_role(ctx.author))
  106.  
  107. await ctx.send(f'Ha! You lost, you\'re gay now! The number was {number}!')
  108. elif number > int(guess.content):
  109. await ctx.send('Too low!')
  110. else:
  111. await ctx.send('Too high!')
  112. turnCount -= 1
  113. elif guess.author.name == ctx.author.name and int(min) > int(guess.content) or int(max) < int(guess.content):
  114. await ctx.send(f'Your number is out of range! Choose a number between {min} and {max}.')
  115.  
  116.  
  117. @client.command()
  118. async def logout(ctx):
  119. await ctx.send('Shutting down...')
  120. await client.change_presence(status=discord.Status.offline)
  121. await client.close()
  122.  
  123. client.run(TOKEN)
Advertisement
Add Comment
Please, Sign In to add comment