Advertisement
Guest User

Discord.py Bot

a guest
Mar 19th, 2018
2,132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. import discord
  2. import requests
  3. import asyncio
  4. import time
  5. import random
  6. from discord.ext import commands
  7. import Config
  8.  
  9. bot = commands.Bot(command_prefix='tb!')
  10.  
  11. @bot.command(pass_context=True)
  12. async def info(ctx):
  13.     embed=discord.Embed(title="TutorialBot", description="TutorialBot is a bot created for a tutorial by RedstonedLife", color=0x00ff80)
  14.     embed.add_field(name="ValueName", value="Thevalue", inline=False)
  15.     embed.set_footer(text="Footer text :D")
  16.     await ctx.send(embed=embed)
  17.  
  18. @bot.command(pass_context=True)
  19. async def ping(ctx):
  20.     """Pong"""
  21.     before = time.monotonic()
  22.     message = await ctx.send("Pong!")
  23.     ping = (time.monotonic() - before) * 1000
  24.     await message.edit(content=f'Pong! `{int(ping)}ms`')
  25.    
  26.    
  27. @bot.event
  28. async def on_ready():
  29.     print("Bot is ready for usage!")
  30.  
  31. bot.run(Config.token)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement