Advertisement
theiotlord

Simple Discord Bot [PYTHON]

Nov 17th, 2019
1,020
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. # Written By TheIotLord
  2.  
  3. import discord
  4. from discord.ext import commands
  5.  
  6. ibot = commands.Bot(command_prefix = '.')
  7. ibot.remove_command('help')
  8.  
  9. @ibot.event
  10. async def on_ready():
  11. print('Online.')
  12.  
  13. @ibot.command()
  14. async def ping(ctx, host):
  15. hostname = "{}".format(host)
  16. response = os.system('ping ' + hostname)
  17.  
  18. if response == 0:
  19. await ctx.send('```Status: ' + hostname + ' Online```')
  20. else:
  21. await ctx.send('```Status: ' + hostname + ' Offline```')
  22.  
  23. @ibot.command(pass_context=True)
  24. async def help(ctx):
  25. author = ctx.message.author
  26.  
  27. embed = discord.Embed(
  28. colour = discord.Colour.blue()
  29. )
  30.  
  31. embed.set_thumbnail(url=author.avatar_url)
  32. embed.set_footer(icon_url=ctx.author.avatar_url)
  33. embed.add_field(name='.help', value='Shows this menu', inline=False)
  34. embed.add_field(name='.ping', value='Checks connections status', inline=False)
  35.  
  36. await ctx.send(embed=embed)
  37.  
  38. ibot.run('YOURTOKENHERE')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement