SHARE
TWEET

Untitled

a guest Nov 8th, 2019 141 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from discord.ext import commands
  2. import discord as ds
  3. import json
  4. from random import randint
  5.  
  6. TOKEN = "NjQyMTkyMjQ5NTYzOTA2MDUw.XcXilg.6ngBcj35s1H5fVSvXLUH2FJoSmU"
  7. PREFIX = "e!"
  8. DESCRIPTION = "EchoBot is here for all your wishing needs."
  9.  
  10. bot = commands.Bot(command_prefix = PREFIX, description = DESCRIPTION)
  11.  
  12. extensions = ['cogs.poke']
  13.  
  14. @bot.event
  15. async def on_ready():
  16.     print('Logged in as')
  17.     print(f'Bot-Name: {bot.user.name}')
  18.     print(f'Bot-ID: {bot.user.id}')
  19.     await bot.change_presence(status=ds.Status.online, activity=ds.Game(name="Repeat"))
  20.  
  21. # General commands
  22. @bot.command()
  23. async def ping(ctx):  # e!ping
  24.     """Test bot latency"""
  25.     await ctx.send(f'My reply took {round(bot.latency * 1000)}ms. Get a move on, ya whippersnapper.')
  26.  
  27. @bot.command()
  28. async def poke(ctx):  # e!poke
  29.     """Poke Echo."""
  30.     with open('assets/arrays/poke.json') as json_file:
  31.         phrases = json.load(json_file)
  32.         random = randint(0, len(phrases['poke']) - 1)
  33.         await ctx.send(str(phrases['poke'][random]))
  34.  
  35. # Fun commands
  36. @bot.command()
  37. async def wish(ctx, args):
  38.     """let Echo grant you a wish"""
  39.     if len(args) == 0:
  40.         await ctx.send("Well okay then, then I won't grant you your wish.")
  41.         return
  42.  
  43.     with open('assets/arrays/wish.json') as json_file:
  44.         phrases = json.load(json_file)
  45.         random = randint(0, len(phrases['wish']) - 1)
  46.         await ctx.send(str(phrases['wish'][random]))
  47.  
  48.  
  49. if __name__ == '__main__':
  50.     for extension in extensions:
  51.         try:
  52.             bot.load_extension(extension)
  53.         except ModuleNotFoundError:
  54.             print(f"Couldn't load extension '{extension}': extension not found.")
  55.         except Exception:
  56.             print(f"Couldn't load extension '{extension}': {0}".format(Exception))
  57.  
  58. bot.run(TOKEN)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top