diff options
-rwxr-xr-x | cogs/admin.py | 4 | ||||
-rwxr-xr-x | cogs/help.py | 366 | ||||
-rwxr-xr-x | cogs/src.py | 84 | ||||
-rwxr-xr-x | cogs/utils.py | 3 | ||||
-rwxr-xr-x | custom_commands.json | 2 |
5 files changed, 437 insertions, 22 deletions
diff --git a/cogs/admin.py b/cogs/admin.py index cf9d8a5..b3cc4f2 100755 --- a/cogs/admin.py +++ b/cogs/admin.py @@ -13,7 +13,7 @@ class Admin(commands.Cog): @commands.command(aliases=['addcommand', 'newcommand']) @commands.check(is_mod) async def setcommand(self, ctx, command, *, message): - self.bot.custom_commands["/" + command] = message + self.bot.custom_commands[ctx.prefix + command] = message with open('custom_commands.json', 'w') as f: json.dump(self.bot.custom_commands, f) @@ -22,7 +22,7 @@ class Admin(commands.Cog): @commands.command(aliases=['deletecommand']) @commands.check(is_mod) async def removecommand(self, ctx, command): - del self.bot.custom_commands["/" + command] + del self.bot.custom_commands[ctx.prefix + command] with open('custom_commands.json', 'w') as f: json.dump(self.bot.custom_commands, f) diff --git a/cogs/help.py b/cogs/help.py index e508650..fd5c14a 100755 --- a/cogs/help.py +++ b/cogs/help.py @@ -2,21 +2,363 @@ from discord.ext import commands from random import randint class MyHelpCommand(commands.MinimalHelpCommand): - messages = ["...!", ".party()!", "<PLAYERNAME> IS YOU", - "10 years of Mining and Crafting!", + 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!", - "20 GOTO 10!", - "~~4815162342~~ 5 at most lines of code!", - "90210!", - "A skeleton popped out!", - "Absolutely fixed relatively broken coordinates", - "Absolutely no memes!", - "Afraid of the big, black bat!", - "Age of Wonders is better!", - "Ahhhhhh!"] - aliases_heading = "Other options: " + "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): diff --git a/cogs/src.py b/cogs/src.py index 708d3fc..35815cf 100755 --- a/cogs/src.py +++ b/cogs/src.py @@ -7,6 +7,49 @@ import json import asyncio from datetime import timedelta +async def rejectRun(self, apiKey, ctx, run, reason): + await ctx.message.delete() + run = run.split('/')[-1] + reject = { + "status": { + "status": "rejected", + "reason": reason + } + } + r = requests.put(f"https://www.speedrun.com/api/v1/runs/{run}/status", headers={"X-API-Key":apiKey, "Accept": "application/json","User-Agent":"mcbeDiscordBot/1.0"}, data=json.dumps(reject)) + if r.status_code == 200 or r.status_code == 204: + await ctx.send("Run rejected succesfully") + else: + await ctx.send("Something went wrong") + await ctx.message.author.send(f"```json\n{json.dumps(json.loads(r.text),indent=4)}```") + +async def approveRun(self, apiKey, ctx, run, reason=None): + await ctx.message.delete() + run = run.split('/')[-1] + approve = { + "status": { + "status": "verified", + "reason": reason + } + } + r = requests.put(f"https://www.speedrun.com/api/v1/runs/{run}/status", headers={"X-API-Key":apiKey, "Accept": "application/json","User-Agent":"mcbeDiscordBot/1.0"}, data=json.dumps(approve)) + if r.status_code == 200 or r.status_code == 204: + await ctx.send("Run approved succesfully") + else: + await ctx.send("Something went wrong") + await ctx.message.author.send(f"```json\n{json.dumps(json.loads(r.text),indent=4)}```") + +async def deleteRun(self, apiKey, ctx, run): + await ctx.message.delete() + run = run.split('/')[-1] + r = requests.delete(f"https://www.speedrun.com/api/v1/runs/{run}", headers={"X-API-Key":apiKey,"Accept": "application/json","User-Agent":"mcbeDiscordBot/1.0"}) + if r.status_code == 200 or r.status_code == 204: + await ctx.send("Run deleted succesfully") + else: + await ctx.send("Something went wrong") + await ctx.message.author.send(f"```json\n{json.dumps(json.loads(r.text),indent=4)}```") + + async def verifyRole(self, ctx, apiKey): server = self.bot.get_guild(574267523869179904) RunneRole = server.get_role(574268937454223361) @@ -51,20 +94,25 @@ async def pendingRuns(self, ctx): gameID = 'yd4ovvg1' # ID of Minecraft bedrock gameID2 = 'v1po7r76' # ID of Category extension runsRequest = requests.get( - f'https://www.speedrun.com/api/v1/runs?game={gameID}&status=new&max=200&embed=category,players', headers=head) + f'https://www.speedrun.com/api/v1/runs?game={gameID}&status=new&max=200&embed=category,players,level', headers=head) runs = json.loads(runsRequest.text) runsRequest2 = requests.get( - f'https://www.speedrun.com/api/v1/runs?game={gameID2}&status=new&max=200&embed=category,players', headers=head) + f'https://www.speedrun.com/api/v1/runs?game={gameID2}&status=new&max=200&embed=category,players,level', headers=head) runs2 = json.loads(runsRequest2.text) # Use https://www.speedrun.com/api/v1/games?abbreviation=mcbe for ID for game in range(2): for i in range(200): + level = False try: for key, value in runs['data'][i].items(): if key == 'weblink': link = value - if key == 'category': + if key == 'level': + if value["data"]: + level = True + categoryName = value["data"]["name"] + if key == 'category' and not level: categoryName = value["data"]["name"] if key == 'players': if value["data"][0]['rel'] == 'guest': @@ -74,6 +122,7 @@ async def pendingRuns(self, ctx): if key == 'times': rta = timedelta(seconds=value['realtime_t']) except Exception as e: + print(e.args) break if game == 0: leaderboard = "Minecraft bedrock" @@ -90,11 +139,15 @@ class Src(commands.Cog): def __init__(self, bot): self.bot = bot + async def is_mod(ctx): + return ctx.author.guild_permissions.manage_channels + @commands.command(description="Posts all pending runs to #pending-runs") @commands.guild_only() async def pending(self, ctx): - await clear(self) - await pendingRuns(self, ctx) + async with ctx.typing(): + await clear(self) + await pendingRuns(self, ctx) @commands.command() async def verify(self, ctx, apiKey=None): @@ -103,7 +156,26 @@ class Src(commands.Cog): return elif ctx.guild != None: await ctx.message.delete() - await verifyRole(self, ctx, apiKey) + async with ctx.typing(): + await verifyRole(self, ctx, apiKey) + + @commands.command(description="Reject runs quickly") + @commands.check(is_mod) + @commands.guild_only() + async def reject(self, ctx, apiKey, run, *, reason): + await rejectRun(self, apiKey, ctx, run, reason) + + @commands.command(description="Approve runs quickly") + @commands.check(is_mod) + @commands.guild_only() + async def approve(self, ctx, apiKey, run, *, reason=None): + await approveRun(self, apiKey, ctx, run, reason) + + @commands.command(description="Delete runs quickly") + @commands.check(is_mod) + @commands.guild_only() + async def delete(self, ctx, apiKey, run): + await deleteRun(self, apiKey, ctx, run) def setup(bot): bot.add_cog(Src(bot))
\ No newline at end of file diff --git a/cogs/utils.py b/cogs/utils.py index 1555d58..19d16b0 100755 --- a/cogs/utils.py +++ b/cogs/utils.py @@ -60,7 +60,8 @@ class Utils(commands.Cog): @findseed.error async def findseed_handler(self,ctx,error): if isinstance(error, commands.CommandOnCooldown): - await ctx.send(f"{ctx.message.author.display_name}, you have to wait {round(error.retry_after, 2)} seconds before using this again.") + return + #await ctx.send(f"{ctx.message.author.display_name}, you have to wait {round(error.retry_after, 7)} seconds before using this again.") @commands.Cog.listener() async def on_message(self, message): diff --git a/custom_commands.json b/custom_commands.json index db953e3..e1499a5 100755 --- a/custom_commands.json +++ b/custom_commands.json @@ -1 +1 @@ -{"/src": "https://www.speedrun.com/mcbe", "/launcher": "https://github.com/MCMrARM/mc-w10-version-launcher/releases/tag/0.1.0", "/locate": "head north", "/boards": "https://www.speedrun.com/mcbe", "/leaderboards": "https://www.speedrun.com/mcbe", "/ban": "shut up", "/ssg": "https://www.speedrun.com/mcbe#Any_Glitchless"}
\ No newline at end of file +{"/src": "https://www.speedrun.com/mcbe", "/launcher": "https://github.com/MCMrARM/mc-w10-version-launcher/releases/tag/0.1.0", "/locate": "head north", "/boards": "https://www.speedrun.com/mcbe", "/leaderboards": "https://www.speedrun.com/mcbe", "/ban": "shut up", "/ssg": "https://www.speedrun.com/mcbe#Any_Glitchless", "/hoes": "stop asking for this shit", "/Make": "Troll Supermod", "/Don't": "Buy The Sun Newspaper", "/Troll": "is Super at his job", "/troll": "The greatest mod this game has", "/welcome": "Welcome! <:Cake:619552132298964993>"}
\ No newline at end of file |