SHARE
TWEET

Untitled

ajdrno Jul 19th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import sys
  2. from traceback import print_exc
  3. import random
  4. from urlextract import URLExtract
  5. from googlesearch import search
  6. from google_images_download import google_images_download
  7. import discord
  8. from discord.ext import commands
  9.  
  10. client = discord.Client()
  11.  
  12. bot = commands.Bot(command_prefix='.', description='super computer robot')
  13.  
  14. bot.remove_command('help')
  15.  
  16.  
  17. @bot.event
  18. async def on_ready():
  19.     print("logged in as")
  20.     print(bot.user.name)
  21.     print(bot.user.id)
  22.     print("---------")
  23.  
  24.  
  25. # admin
  26. @bot.command()
  27. @commands.has_role("High Council of Emoji")
  28. async def terminate(ctx):
  29.     await ctx.send("Personal PC Computer plugging off online mode shut down - COMPUTER OFF")
  30.     print("terminate request received")
  31.     sys.exit()
  32.  
  33.  
  34. @terminate.error
  35. async def terminate_error(ctx, error):
  36.     if isinstance(error, commands.CheckFailure):
  37.         username = ctx.message.author.display_name
  38.         userid = ctx.message.author.id
  39.         variable = [
  40.             "You do not have the clearance for that command... are you retarded?",
  41.             "You aren't a server admin... this is why she left you dude.",
  42.             "Try that shit again and see who gets terminated bitch ;)",
  43.             "It seems like there's a lot you don't know about terminating this bot",
  44.         ]
  45.         await ctx.send(random.choice(variable))
  46.         print("insufficient perms to terminate " + username + " " + str(userid))
  47.  
  48.  
  49. # documentation
  50. @bot.command()
  51. async def info(ctx):
  52.     embed = discord.Embed(title="computer", description="Basic Discord bot", color=0xee657)
  53.     embed.add_field(name="Author(s)", value="Jordan#1887")
  54.     embed.add_field(name="Version", value="0.000000000001")
  55.     embed.add_field(name="Framework", value="Python 3.7.4 \nDiscord.py API 1.2.3")
  56.     await ctx.send(embed=embed)
  57.  
  58.  
  59. @bot.command()
  60. async def help(ctx):
  61.     embed = discord.Embed(title="computer", description="Hello I am computer", color=0xeee657)
  62.     await ctx.send(embed=embed)
  63.  
  64.  
  65. # math
  66. @bot.command()
  67. async def add(ctx, a: int, b: int):
  68.     await ctx.send(a + b)
  69.  
  70.  
  71. @bot.command()
  72. async def multiply(ctx, a: int, b: int):
  73.     await ctx.send(a * b)
  74.  
  75.  
  76. # web search utilities
  77. @bot.command()
  78. async def g(ctx):
  79.     query = ctx.message.content[3:]
  80.     for j in search(query, tld="co.in", num=1, stop=1, pause=2):
  81.         await ctx.send(j)
  82.  
  83. @bot.command()
  84. async def img(ctx):
  85.     imgquery = ctx.message.content[5:]
  86.     response = google_images_download.googleimagesdownload()
  87.     arguments = {"keywords":imgquery,"limit":1,"no_download":True}
  88.     imgresult = response.download(arguments)
  89.     extractor = URLExtract()
  90.     for url in extractor.gen_urls(str(imgresult)):
  91.         await ctx.send(url)
  92.  
  93.  
  94.  
  95. bot.run("NTk4OTI0ODQ5MDU4MDIxMzkz.XSzbdA.BQsFNZRLCXE1VQXRWonFQK7YnMA")
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
 
Top