Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. import discord
  2. from discord.ext import commands
  3.  
  4. client = commands.Bot(command_prefix = 't.')
  5. client.remove_command('help')
  6.  
  7. @client.event
  8. async def on_ready():
  9. await client.change_presence(game=discord.Game(name='Test'))
  10. print("Bot is ready")
  11.  
  12. @client.command()
  13. async def ping():
  14. await client.say('Pong!')
  15.  
  16. @client.command()
  17. async def say(*args):
  18. output = ''
  19. for word in args:
  20. output += word
  21. output += ' '
  22. await client.say(output)
  23.  
  24. @client.command(pass_context=True)
  25. async def clear(ctx, amount=100):
  26. channel = ctx.message.channel
  27. messages = []
  28. async for message in client.logs_from(channel, limit=int(amount)):
  29. messages.append(message)
  30. await client.delete_messages(messages)
  31. await client.say('I deleted the messages!')
  32.  
  33. @client.command(pass_context=True)
  34. async def joinchannel(ctx):
  35. channel = ctx.message.author.voice_channel
  36. await client.join_voice_channel(channel)
  37.  
  38. @client.command(pass_context=True)
  39. async def leavechannel(ctx):
  40. server = ctx.message.server
  41. voice_client = client.voice_client_in(server)
  42. await voice_client.disconnect()
  43.  
  44. @client.command(pass_context=True)
  45. async def help(ctx):
  46. author = ctx.message.author
  47.  
  48. embed = discord.Embed(
  49. color = discord.Color.green()
  50. )
  51.  
  52. embed.set_author(name='Commands')
  53. embed.add_field(name='t.help', value='Shows the commands!', inline=False)
  54. embed.add_field(name='t.ping', value='Responds with Pong!', inline=False)
  55.  
  56. await client.send_message(author, embed=embed)
  57.  
  58.  
  59.  
  60. client.run('NTEzNjcyOTkzNTcxMDc4MTQ0.DtMgHw.kp20ut_NqmdVy4nVwS_BpauYc9Q')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement