From 55cef1c7b6c6f4703eedae29965f5b1df5573a56 Mon Sep 17 00:00:00 2001 From: AnInternetTroll Date: Sat, 4 Jul 2020 16:52:20 +0100 Subject: Command descriptions added --- cogs/general.py | 466 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 464 insertions(+), 2 deletions(-) (limited to 'cogs/general.py') diff --git a/cogs/general.py b/cogs/general.py index 57bf044..968332b 100755 --- a/cogs/general.py +++ b/cogs/general.py @@ -4,6 +4,13 @@ import datetime import requests import json import dateutil.parser +from random import randint +import os, sys, inspect +current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) +parent_dir = os.path.dirname(current_dir) +sys.path.insert(0, parent_dir) +import bot + def dump(obj): output = "" @@ -13,12 +20,395 @@ def dump(obj): return output +class MyHelpCommand(commands.MinimalHelpCommand): + messages = [ + "As seen on TV!", + "Awesome!", + "100% pure!", + "May contain nuts!", + "Better than Prey!", + "More polygons!", + "Sexy!", + "Limited edition!", + "Flashing letters!", + "Made by Notch!", + "It's here!", + "Best in class!", + "It's finished!", + "Kind of dragon free!", + "Excitement!", + "More than 500 sold!", + "One of a kind!", + "Heaps of hits on YouTube!", + "Indev!", + "Spiders everywhere!", + "Check it out!", + "Holy cow", + " man!", + "It's a game!", + "Made in Sweden!", + "Uses LWJGL!", + "Reticulating splines!", + "Minecraft!", + "Yaaay!", + "Singleplayer!", + "Keyboard compatible!", + "Undocumented!", + "Ingots!", + "Exploding creepers!", + "That's no moon!", + "l33t!", + "Create!", + "Survive!", + "Dungeon!", + "Exclusive!", + "The bee's knees!", + "Down with O.P.P.!", + "Closed source!", + "Classy!", + "Wow!", + "Not on steam!", + "Oh man!", + "Awesome community!", + "Pixels!", + "Teetsuuuuoooo!", + "Kaaneeeedaaaa!", + "Now with difficulty!", + "Enhanced!", + "90% bug free!", + "Pretty!", + "12 herbs and spices!", + "Fat free!", + "Absolutely no memes!", + "Free dental!", + "Ask your doctor!", + "Minors welcome!", + "Cloud computing!", + "Legal in Finland!", + "Hard to label!", + "Technically good!", + "Bringing home the bacon!", + "Indie!", + "GOTY!", + "Ceci n'est pas une title screen!", + "Euclidian!", + "Now in 3D!", + "Inspirational!", + "Herregud!", + "Complex cellular automata!", + "Yes", + " sir!", + "Played by cowboys!", + "OpenGL 1.2!", + "Thousands of colors!", + "Try it!", + "Age of Wonders is better!", + "Try the mushroom stew!", + "Sensational!", + "Hot tamale", + " hot hot tamale!", + "Play him off", + " keyboard cat!", + "Guaranteed!", + "Macroscopic!", + "Bring it on!", + "Random splash!", + "Call your mother!", + "Monster infighting!", + "Loved by millions!", + "Ultimate edition!", + "Freaky!", + "You've got a brand new key!", + "Water proof!", + "Uninflammable!", + "Whoa", + " dude!", + "All inclusive!", + "Tell your friends!", + "NP is not in P!", + "Notch <3 ez!", + "Music by C418!", + "Livestreamed!", + "Haunted!", + "Polynomial!", + "Terrestrial!", + "All is full of love!", + "Full of stars!", + "Scientific!", + "Cooler than Spock!", + "Collaborate and listen!", + "Never dig down!", + "Take frequent breaks!", + "Not linear!", + "Han shot first!", + "Nice to meet you!", + "Buckets of lava!", + "Ride the pig!", + "Larger than Earth!", + "sqrt(-1) love you!", + "Phobos anomaly!", + "Punching wood!", + "Falling off cliffs!", + "0% sugar!", + "150% hyperbole!", + "Synecdoche!", + "Let's danec!", + "Seecret Friday update!", + "Reference implementation!", + "Lewd with two dudes with food!", + "Kiss the sky!", + "20 GOTO 10!", + "Verlet intregration!", + "Peter Griffin!", + "Do not distribute!", + "Cogito ergo sum!", + "4815162342 lines of code!", + "A skeleton popped out!", + "The Work of Notch!", + "The sum of its parts!", + "BTAF used to be good!", + "I miss ADOM!", + "umop-apisdn!", + "OICU812!", + "Bring me Ray Cokes!", + "Finger-licking!", + "Thematic!", + "Pneumatic!", + "Sublime!", + "Octagonal!", + "Une baguette!", + "Gargamel plays it!", + "Rita is the new top dog!", + "SWM forever!", + "Representing Edsbyn!", + "Matt Damon!", + "Supercalifragilisticexpialidocious!", + "Consummate V's!", + "Cow Tools!", + "Double buffered!", + "Fan fiction!", + "Flaxkikare!", + "Jason! Jason! Jason!", + "Hotter than the sun!", + "Internet enabled!", + "Autonomous!", + "Engage!", + "Fantasy!", + "DRR! DRR! DRR!", + "Kick it root down!", + "Regional resources!", + "Woo", + " facepunch!", + "Woo", + " somethingawful!", + "Woo", + " /v/!", + "Woo", + " tigsource!", + "Woo", + " minecraftforum!", + "Woo", + " worldofminecraft!", + "Woo", + " reddit!", + "Woo", + " 2pp!", + "Google anlyticsed!", + "Now supports åäö!", + "Give us Gordon!", + "Tip your waiter!", + "Very fun!", + "12345 is a bad password!", + "Vote for net neutrality!", + "Lives in a pineapple under the sea!", + "MAP11 has two names!", + "Omnipotent!", + "Gasp!", + "...!", + "Bees", + " bees", + " bees", + " bees!", + "Jag känner en bot!", + "This text is hard to read if you play the game at the default resolution", + " but at 1080p it's fine!", + "Haha", + " LOL!", + "Hampsterdance!", + "Switches and ores!", + "Menger sponge!", + "idspispopd!", + "Eple (original edit)!", + "So fresh", + " so clean!", + "Slow acting portals!", + "Try the Nether!", + "Don't look directly at the bugs!", + "Oh", + " ok", + " Pigmen!", + "Finally with ladders!", + "Scary!", + "Play Minecraft", + " Watch Topgear", + " Get Pig!", + "Twittered about!", + "Jump up", + " jump up", + " and get down!", + "Joel is neat!", + "A riddle", + " wrapped in a mystery!", + "Huge tracts of land!", + "Welcome to your Doom!", + "Stay a while", + " stay forever!", + "Stay a while and listen!", + "Treatment for your rash!", + "\"Autological\" is!", + "Information wants to be free!", + "\"Almost never\" is an interesting concept!", + "Lots of truthiness!", + "The creeper is a spy!", + "Turing complete!", + "It's groundbreaking!", + "Let our battle's begin!", + "The sky is the limit!", + "Jeb has amazing hair!", + "Ryan also has amazing hair!", + "Casual gaming!", + "Undefeated!", + "Kinda like Lemmings!", + "Follow the train", + " CJ!", + "Leveraging synergy!", + "This message will never appear on the splash screen", + " isn't that weird?", + "DungeonQuest is unfair!", + "110813!", + "90210!", + "Check out the far lands!", + "Tyrion would love it!", + "Also try VVVVVV!", + "Also try Super Meat Boy!", + "Also try Terraria!", + "Also try Mount And Blade!", + "Also try Project Zomboid!", + "Also try World of Goo!", + "Also try Limbo!", + "Also try Pixeljunk Shooter!", + "Also try Braid!", + "That's super!", + "Bread is pain!", + "Read more books!", + "Khaaaaaaaaan!", + "Less addictive than TV Tropes!", + "More addictive than lemonade!", + "Bigger than a bread box!", + "Millions of peaches!", + "Fnord!", + "This is my true form!", + "Totally forgot about Dre!", + "Don't bother with the clones!", + "Pumpkinhead!", + "Hobo humping slobo babe!", + "Made by Jeb!", + "Has an ending!", + "Finally complete!", + "Feature packed!", + "Boots with the fur!", + "Stop", + " hammertime!", + "Testificates!", + "Conventional!", + "Homeomorphic to a 3-sphere!", + "Doesn't avoid double negatives!", + "Place ALL the blocks!", + "Does barrel rolls!", + "Meeting expectations!", + "PC gaming since 1873!", + "Ghoughpteighbteau tchoghs!", + "Déjà vu!", + "Déjà vu!", + "Got your nose!", + "Haley loves Elan!", + "Afraid of the big", + " black bat!", + "Doesn't use the U-word!", + "Child's play!", + "See you next Friday or so!", + "From the streets of Södermalm!", + "150 bpm for 400000 minutes!", + "Technologic!", + "Funk soul brother!", + "Pumpa kungen!", + "日本ハロー!", + "한국 안녕하세요!", + "Helo Cymru!", + "Cześć Polsko!", + "你好中国!", + "Привет Россия!", + "Γεια σου Ελλάδα!", + "My life for Aiur!", + "Lennart lennart = new Lennart();", + "I see your vocabulary has improved!", + "Who put it there?", + "You can't explain that!", + "if not ok then return end", + "§1C§2o§3l§4o§5r§6m§7a§8t§9i§ac", + "§kFUNKY LOL", + "SOPA means LOSER in Swedish!", + "Big Pointy Teeth!", + "Bekarton guards the gate!", + "Mmmph", + " mmph!", + "Don't feed avocados to parrots!", + "Swords for everyone!", + "Plz reply to my tweet!", + ".party()!", + "Take her pillow!", + "Put that cookie down!", + "Pretty scary!", + "I have a suggestion.", + "Now with extra hugs!", + "Now java 6!", + "Woah.", + "HURNERJSGER?", + "What's up", + " Doc?", + "Now contains 32 random daily cats!", + ""] + def get_command_signature(self, command): + return f'``{self.clean_prefix}{command.qualified_name} {command.signature}``' + def get_ending_note(self): + return self.messages[randint(0, len(self.messages)-1)] + class General(commands.Cog): def __init__(self, bot): self.bot = bot + self._original_help_command = bot.help_command + bot.help_command = MyHelpCommand() + bot.help_command.cog = self + + def cog_unload(self): + self.bot.help_command = self._original_help_command + + @commands.command() + async def prefix(self, ctx): + """Gets the bot prefixes""" + prefixes = bot.get_prefix(self.bot, ctx.message) + prefixes.pop(1) + prefixes.pop(1) + prefixes.pop(1) + output = "" + for i in prefixes: + output += i+", " + + await ctx.send(f"My prefixes are {output}") @commands.command() async def userinfo(self, ctx, user: discord.Member=None): + """Get information about a user""" #await ctx.send(f"```py\n{dump(user)}```") if not user: @@ -48,6 +438,7 @@ class General(commands.Cog): @commands.command() async def coop(self, ctx, *, user: discord.Member=None): + """Get the coop gang role""" if not user: user = ctx.message.author else: @@ -64,6 +455,7 @@ class General(commands.Cog): @commands.command() async def serverinfo(self, ctx, guild=None): + """Get information about the server you are in""" if not guild: guild = ctx.message.guild else: @@ -90,7 +482,8 @@ class General(commands.Cog): await ctx.send(embed=embed) @commands.command() - async def xboxUser(self, ctx, *, gamertag=None): + async def xboxuser(self, ctx, *, gamertag=None): + """Get information about an xbox live user""" if not gamertag: await ctx.send("You need to specify a gamer, gamer") return @@ -151,7 +544,7 @@ class General(commands.Cog): embed.add_field(name="Reputation", value=reputation, inline=True) await ctx.send(embed=embed) - @commands.command() + @commands.command(hidden=True) async def xboxpresence(self, ctx, *, gamertag=None): if not gamertag: await ctx.send("You need to specify a gamer, gamer") @@ -187,5 +580,74 @@ class General(commands.Cog): embed=discord.Embed(title=gamer["gamertag"], description=state, timestamp=ctx.message.created_at) await ctx.send(embed=embed) + @commands.command() + async def compile(self, ctx, language=None, *, code=None): + """Compile code from a variety of programming languages, powered by """ + """ + listRequest = requests.get("https://wandbox.org/api/list.json") + compilerList = json.loads(listRequest.text) + + for i in compilerList: + if i["language"] == language: + compiler = i["name"] + print(compiler) + """ + compilers = { + "bash": "bash", + "c":"gcc-head-c", + "c#":"dotnetcore-head", + "coffeescript": "coffeescript-head", + "cpp": "gcc-head", + "elixir": "elixir-head", + "go": "go-head", + "java": "openjdk-head", + "javascript":"nodejs-head", + "lua": "lua-5.3.4", + "perl": "perl-head", + "php": "php-head", + "python":"cpython-3.8.0", + "ruby": "ruby-head", + "rust": "rust-head", + "sql": "sqlite-head", + "swift": "swift-5.0.1", + "typescript":"typescript-3.5.1", + "vim-script": "vim-head" + } + if not language: + await ctx.send(f"```json\n{json.dumps(compilers, indent=4)}```") + if not code: + await ctx.send("No code found") + return + try: + compiler = compilers[language.lower()] + except KeyError: + await ctx.send("Language not found") + return + body = { + "compiler": compiler, + "code": code, + "save": True + } + head = { + "Content-Type":"application/json" + } + async with ctx.typing(): + r = requests.post("https://wandbox.org/api/compile.json", headers=head, data=json.dumps(body)) + try: + response = json.loads(r.text) + #await ctx.send(f"```json\n{json.dumps(response, indent=4)}```") + print(f"```json\n{json.dumps(response, indent=4)}```") + except json.decoder.JSONDecodeError: + await ctx.send(f"```json\n{r.text}```") + + try: + embed=discord.Embed(title="Compiled code") + embed.add_field(name="Output", value=f'```{response["program_message"]}```', inline=False) + embed.add_field(name="Exit code", value=response["status"], inline=True) + embed.add_field(name="Link", value=f"[Permalink]({response['url']})", inline=True) + await ctx.send(embed=embed) + except KeyError: + await ctx.send(f"```json\n{json.dumps(response, indent=4)}```") + def setup(bot): bot.add_cog(General(bot)) -- cgit v1.2.3