Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. from discord.ext import commands
  2. from asyncio import sleep
  3. import string
  4.  
  5. bot = commands.Bot(command_prefix='>')
  6. token = ''
  7.  
  8. bot.timeouts = []
  9. bot.sith = bot.guilds[0]
  10. bot.timeoutchannel = None
  11. bot.staffrole = None
  12. bot.newmembers = []
  13. bot.newmemberchannel = None
  14. bot.member = None
  15.  
  16.  
  17. async def timeout(guild, user, channel):
  18. for vc in guild.voice_channels:
  19. if vc == channel:
  20. continue
  21. elif user.voice == vc:
  22. await user.move_to(channel, reason='Get back in timeout, {}!'.format(user))
  23.  
  24.  
  25. @bot.event
  26. async def on_ready():
  27. bot.activity(type='watching', name='bot by Fury#2591')
  28. bot.remove_command('help')
  29. bot.staffrole = bot.sith.get_role(531390283347132417)
  30. bot.member = bot.sith.get_role(417550412485230593)
  31. while bot.timeoutchannel is not None:
  32. for user in bot.timeouts:
  33. await timeout(bot.sith, user, bot.timeoutchannel)
  34.  
  35.  
  36. @bot.command(name='settimeout')
  37. async def setup(ctx, chan=None):
  38. await ctx.message.delete()
  39. if chan is not None and bot.staffrole in ctx.message.author.roles:
  40. for letter in chan:
  41. if letter.lower() in string.ascii_lowercase:
  42. b = await ctx.send('Error')
  43. await sleep(1.5)
  44. await b.delete()
  45. return
  46. bot.timeoutchannel = bot.get_channel(int(chan))
  47. if bot.timeoutchannel is None:
  48. b = await ctx.send('Error')
  49. await sleep(1.5)
  50. await b.delete()
  51. return
  52. else:
  53. b = await ctx.send('Set.')
  54. await sleep(1.5)
  55. await b.delete()
  56. return
  57. else:
  58. b = await ctx.send('Error')
  59. await sleep(1.5)
  60. await b.delete()
  61.  
  62.  
  63. @bot.command(name='timeout')
  64. async def badboy(ctx, u=None, n=True):
  65. await ctx.message.delete()
  66. user = ctx.message.mentions
  67. if u is not None and bot.staffrole in ctx.message.author.roles and user is not [] and n and u not in bot.timeouts:
  68. bot.timeouts.append(u)
  69. elif u is not None and bot.staffrole in ctx.message.author.roles and user is not [] and not n and u in bot.timeouts:
  70. bot.timeouts.remove(u)
  71. else:
  72. b = await ctx.send('Error')
  73. await sleep(1.5)
  74. await b.delete()
  75.  
  76.  
  77. @bot.event
  78. async def on_message(message):
  79. ctx = await bot.get_context(message)
  80. if not ctx.valid and message.author != bot.user and bot.newmemberchannel is not None and bot.member is not None and message.channel == bot.newmemberchannel and message.author.roles == []:
  81. await message.author.add_roles(bot.member, reason='They spoke after they joined.')
  82. else:
  83. await bot.process_commands(message)
  84.  
  85. bot.run(token)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement