Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.97 KB | None | 0 0
  1. import discord
  2. from discord.ext import commands
  3. import random
  4.  
  5.  
  6. client = commands.Bot(command_prefix = '.')
  7. client.remove_command('help')
  8.  
  9.  
  10. @client.event
  11. async def on_ready():
  12.     print('Ready.')
  13.  
  14.  
  15. @client.event
  16. async def on_member_join(member):
  17.     print(f'{member} has joined a server.')
  18.  
  19. @client.event
  20. async def on_member_remove(member):
  21.     print(f'{member} has left a server.')
  22.  
  23. @client.command()
  24. async def ping(ctx):
  25.     await ctx.send (f'Pong! `{round(client.latency * 1000)}ms`')
  26.  
  27.  
  28. @client.command(aliases=['8ball'])
  29. async def _8ball(ctx, *, question):
  30.     responses = [
  31.         'It is certain.',
  32.         'It is decidedly so.',
  33.         'Without a doubt.',
  34.         'Yes - definitely.',
  35.         'You may rely on it.',
  36.         'As I see it, yes.',
  37.         'Most likely.',
  38.         'Outlook good.',
  39.         'Yes.',
  40.         'Signs point to yes.',
  41.         'Reply hazy, try again.',
  42.         'Ask again later.',
  43.         'Better not tell you now.',
  44.         'Cannot predict now.',
  45.         'Concentrate and ask again.',
  46.         'Do not count on it.',
  47.         'My reply is no.',
  48.         'My sources say no.',
  49.         'Outlook not so good.',
  50.         'Very doubtful.']
  51.  
  52.     await ctx.send(f'Question: {question}\nAnswer: {random.choice(responses)}')
  53.  
  54.  
  55.  
  56. @client.command()
  57. @commands.has_permissions(manage_message=True)
  58. async def clear(ctx, amount=10):
  59.     await ctx.channel.purge(limit=amount)
  60.     print('Test')
  61.  
  62.  
  63.  
  64. @client.command()
  65. @commands.has_permissions(manage_message=True)
  66. async def kick(ctx, member : discord.Member, *, reason=None):
  67.     await member.kick(reason=reason)
  68.     await ctx.send(f'`Kicked {member.mention}!`')
  69.  
  70.  
  71.  
  72. @client.command()
  73. @commands.has_permissions(manage_message=True)
  74. async def ban(ctx, member : discord.Member, *, reason=None):
  75.     await member.ban(reason=reason)
  76.     await ctx.send(f'`Banned {member.mention}!')
  77.  
  78.  
  79.  
  80.  
  81. @client.command()
  82. @commands.has_permissions(manage_message=True)
  83. async def unban(ctx, *, member):
  84.  
  85.     banned_users = await ctx.guild.bans()
  86.  
  87.     for ban_entry in banned_users:
  88.  
  89.         user = ban_entry.user
  90.  
  91.         await ctx.guild.unban(user)
  92.  
  93.         await ctx.send(f'`Unbanned user!`')
  94.  
  95.  
  96. @client.command()
  97. async def embed(ctx, member: discord.Member):
  98.     embed = discord.Embed(colour=member.color, timestamp=ctx.message.created_at)
  99.  
  100.     embed.add_field(name=f'{member}', value='Yes daddy.. sorry')
  101.  
  102.     await ctx.send(embed=embed)
  103.  
  104.  
  105.  
  106. @client.event
  107. async def on_command_error(ctx, error):
  108.     if isinstance(error, commands.MissingRequiredArgument):
  109.         await ctx.send('Please put in all required arguments, if you want this command to work :).')
  110.     elif isinstance(error, commands.CommandNotFound):
  111.         await ctx.send('Command not found.')
  112.  
  113.  
  114.  
  115.  
  116. @client.command()
  117. async def help(ctx):
  118.     embed = discord.Embed(description='Commands')
  119.     embed.add_field(name='Embed', value=embed_description)
  120.     await ctx.send(embed=embed)
  121.  
  122.  
  123.  
  124. client.run(ErXCKAJn3Sm195qeDHaiR-6o')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement