Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from discord.ext import commands
- from asyncio import sleep
- import string
- bot = commands.Bot(command_prefix='>')
- token = ''
- bot.timeouts = []
- bot.sith = bot.guilds[0]
- bot.timeoutchannel = None
- bot.staffrole = None
- bot.newmembers = []
- bot.newmemberchannel = None
- bot.member = None
- async def timeout(guild, user, channel):
- for vc in guild.voice_channels:
- if vc == channel:
- continue
- elif user.voice == vc:
- await user.move_to(channel, reason='Get back in timeout, {}!'.format(user))
- @bot.event
- async def on_ready():
- bot.activity(type='watching', name='bot by Fury#2591')
- bot.remove_command('help')
- bot.staffrole = bot.sith.get_role(531390283347132417)
- bot.member = bot.sith.get_role(417550412485230593)
- while bot.timeoutchannel is not None:
- for user in bot.timeouts:
- await timeout(bot.sith, user, bot.timeoutchannel)
- @bot.command(name='settimeout')
- async def setup(ctx, chan=None):
- await ctx.message.delete()
- if chan is not None and bot.staffrole in ctx.message.author.roles:
- for letter in chan:
- if letter.lower() in string.ascii_lowercase:
- b = await ctx.send('Error')
- await sleep(1.5)
- await b.delete()
- return
- bot.timeoutchannel = bot.get_channel(int(chan))
- if bot.timeoutchannel is None:
- b = await ctx.send('Error')
- await sleep(1.5)
- await b.delete()
- return
- else:
- b = await ctx.send('Set.')
- await sleep(1.5)
- await b.delete()
- return
- else:
- b = await ctx.send('Error')
- await sleep(1.5)
- await b.delete()
- @bot.command(name='timeout')
- async def badboy(ctx, u=None, n=True):
- await ctx.message.delete()
- user = ctx.message.mentions
- 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:
- bot.timeouts.append(u)
- 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:
- bot.timeouts.remove(u)
- else:
- b = await ctx.send('Error')
- await sleep(1.5)
- await b.delete()
- @bot.event
- async def on_message(message):
- ctx = await bot.get_context(message)
- 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 == []:
- await message.author.add_roles(bot.member, reason='They spoke after they joined.')
- else:
- await bot.process_commands(message)
- bot.run(token)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement