aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--[-rwxr-xr-x].gitignore2
-rw-r--r--[-rwxr-xr-x].vscode/settings.json0
-rw-r--r--[-rwxr-xr-x]bot.py0
-rw-r--r--[-rwxr-xr-x]cogs/admin.py23
-rw-r--r--[-rwxr-xr-x]cogs/general.py0
-rw-r--r--[-rwxr-xr-x]cogs/help.py0
-rw-r--r--[-rwxr-xr-x]cogs/player.py4
-rw-r--r--[-rwxr-xr-x]cogs/src.py0
-rw-r--r--[-rwxr-xr-x]cogs/trans.py0
-rw-r--r--[-rwxr-xr-x]cogs/utils.py29
-rw-r--r--[-rwxr-xr-x]custom_commands.json2
-rw-r--r--[-rwxr-xr-x]main.py0
-rw-r--r--palette.pngbin0 -> 591 bytes
13 files changed, 55 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 8ba483d..384c5f5 100755..100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,4 @@ discord.log
api_keys.json
.vscode/
leaderboard.png
-youtube* \ No newline at end of file
+downloads/ \ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 478c149..478c149 100755..100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
diff --git a/bot.py b/bot.py
index 7a1990c..7a1990c 100755..100644
--- a/bot.py
+++ b/bot.py
diff --git a/cogs/admin.py b/cogs/admin.py
index 0613b5d..05be209 100755..100644
--- a/cogs/admin.py
+++ b/cogs/admin.py
@@ -86,6 +86,21 @@ class Admin(commands.Cog):
await ctx.send(f'Some unknown error happened while trying to reload extension {ext} (check logs)')
self.bot.logger.exception(f'Failed to reload extension {ext}:')
+ @commands.check(is_mod)
+ @commands.command(name='unload', hidden=True, usage='<extension>')
+ async def _unload(self, ctx, ext):
+ """Loads an extension"""
+ try:
+ self.bot.unload_extension(f'cogs.{ext}')
+ await ctx.send(f'The extension {ext} was unloaded!')
+ except commands.ExtensionNotFound:
+ await ctx.send(f'The extension {ext} doesn\'t exist!')
+ except commands.NoEntryPointError:
+ await ctx.send(f'The extension {ext} doesn\'t have an entry point (try adding the setup function)')
+ except commands.ExtensionFailed:
+ await ctx.send(f'Some unknown error happened while trying to reload extension {ext} (check logs)')
+ self.bot.logger.exception(f'Failed to reload extension {ext}:')
+
"""
@commands.command()
@commands.check(is_mod)
@@ -139,6 +154,14 @@ class Admin(commands.Cog):
await i.remove_roles(muted_role)
await ctx.send("{0.mention} has been unmuted by {1.mention}".format(i, ctx.author))
+ @commands.command()
+ @commands.check(is_mod)
+ async def logs(self, ctx, *, password):
+ if password == "beep boop":
+ await ctx.message.delete()
+ file = discord.File("discord.log")
+ await ctx.send(file=file)
+
def setup(bot):
diff --git a/cogs/general.py b/cogs/general.py
index ff60bb7..ff60bb7 100755..100644
--- a/cogs/general.py
+++ b/cogs/general.py
diff --git a/cogs/help.py b/cogs/help.py
index 91c9c45..91c9c45 100755..100644
--- a/cogs/help.py
+++ b/cogs/help.py
diff --git a/cogs/player.py b/cogs/player.py
index 6a91318..5c046a7 100755..100644
--- a/cogs/player.py
+++ b/cogs/player.py
@@ -14,7 +14,7 @@ youtube_dl.utils.bug_reports_message = lambda: ''
ytdl_format_options = {
'format': 'bestaudio/best',
- 'outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s',
+ 'outtmpl': 'downloads/%(extractor)s-%(id)s-%(title)s.%(ext)s',
'restrictfilenames': True,
'noplaylist': True,
'nocheckcertificate': True,
@@ -136,7 +136,7 @@ class Player(commands.Cog):
@tasks.loop(hours=10.0)
async def cleanup(self):
- for p in Path(".").glob("youtube*"):
+ for p in Path("./downloads/").glob("*"):
p.unlink()
diff --git a/cogs/src.py b/cogs/src.py
index 96bf53c..96bf53c 100755..100644
--- a/cogs/src.py
+++ b/cogs/src.py
diff --git a/cogs/trans.py b/cogs/trans.py
index 2c6ed71..2c6ed71 100755..100644
--- a/cogs/trans.py
+++ b/cogs/trans.py
diff --git a/cogs/utils.py b/cogs/utils.py
index 7a1d79c..5ff7d81 100755..100644
--- a/cogs/utils.py
+++ b/cogs/utils.py
@@ -15,7 +15,14 @@ from selenium.webdriver.chrome.options import Options
#from PIL.Image import core as Image
#import image as Image
from PIL import Image
-import numpy as np
+from PIL import ImageFilter
+
+def set_viewport_size(driver, width, height):
+ window_size = driver.execute_script("""
+ return [window.outerWidth - window.innerWidth + arguments[0],
+ window.outerHeight - window.innerHeight + arguments[1]];
+ """, width, height)
+ driver.set_window_size(*window_size)
async def reportStuff(self, ctx, message):
channel = self.bot.get_channel(715549209998262322)
@@ -141,6 +148,7 @@ class Utils(commands.Cog):
else:
await reportStuff(self, ctx, message)
+ @commands.cooldown(1, 20, commands.BucketType.member)
@commands.command()
async def leaderboard(self, ctx):
async with ctx.typing():
@@ -152,11 +160,16 @@ class Utils(commands.Cog):
chrome_options.add_argument("--disable-gpu")
#chrome_options.binary_location = ""
driver = webdriver.Chrome(DRIVER, chrome_options=chrome_options)
+ set_viewport_size(driver, 1000, 1000)
driver.get('https://aninternettroll.github.io/mcbeVerifierLeaderboard/')
screenshot = driver.find_element_by_id('table').screenshot('leaderboard.png')
driver.quit()
#transparency time
img = Image.open('leaderboard.png')
+ img = img.convert("RGB")
+ pallette = Image.open("palette.png")
+ pallette = pallette.convert("P")
+ img = img.quantize(colors=256, method=3, kmeans=0, palette=pallette)
img = img.convert("RGBA")
datas = img.getdata()
@@ -168,9 +181,23 @@ class Utils(commands.Cog):
newData.append(item)
img.putdata(newData)
+ """
+ img = img.filter(ImageFilter.SHARPEN)
+ img = img.filter(ImageFilter.SHARPEN)
+ img = img.filter(ImageFilter.SHARPEN)
+ """
+ #height, width = img.size
+ #img = img.resize((height*10,width*10), resample=Image.BOX)
img.save("leaderboard.png", "PNG")
await ctx.send(file=discord.File("leaderboard.png"))
+
+
+ @leaderboard.error
+ async def leaderboard_handler(self,ctx,error):
+ if isinstance(error, commands.CommandOnCooldown):
+ #return
+ await ctx.send(f"{ctx.message.author.display_name}, you have to wait {round(error.retry_after, 2)} seconds before using this again.")
# Why? Because I can. lel
diff --git a/custom_commands.json b/custom_commands.json
index 44e0d48..7664008 100755..100644
--- 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", "/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>", "/pending": "this annoys me", "!murray": "the irishest of the Irish", "!HereWeGo": "10 in a Row!", "!GlasgowRangers": "You Let Your Club Die!", "!hwg": "10 iar", "!When-you-walk-through-a-storm": "hold your head up high", "!At-the-end-of-a-Storm": "there's a golden sky and the sweet silver song of the lark", "!Walk-On": "Walk On with hope in your hearts and You'll Never Walk Alone", "!Walk-On-through-the-Wind": "Walk On through the rain", "!For-your-dreams": "be tossed and blown", "!When-you-walk": "through a storm hold your head up high and don't be afraid of the dark\nAt the end of a Storm there's a golden sky and the sweet silver song of the lark\nWalk on through the wind\nWalk on through the rain, for your dreams be tossed and blown\nWalk On, Walk On with hope in your hearts and You'll Never Walk Alone, **YOU'LL NEVER WALK ALONE**\nWalk On, Walk On with hope in your hearts and You'll Never Walk Alone, **YOU'LL NEVER WALK ALONE**", "!Scotland'sNo1": "Celtic", "/swipe": "not an alt", "!blacklist": "Done! That felt good", "/blacklist": "Done! That felt good", "!sr.c": "https://www.speedrun.com/mcbe", "!h": "<@!199070670221475842> no swearing in this christian discord server", "!lenny": "( \u0361\u00b0 \u035c\u0296 \u0361\u00b0)"} \ 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>", "/pending": "this annoys me", "!murray": "the irishest of the Irish", "!HereWeGo": "10 in a Row!", "!GlasgowRangers": "You Let Your Club Die!", "!hwg": "10 iar", "!When-you-walk-through-a-storm": "hold your head up high", "!At-the-end-of-a-Storm": "there's a golden sky and the sweet silver song of the lark", "!Walk-On": "Walk On with hope in your hearts and You'll Never Walk Alone", "!Walk-On-through-the-Wind": "Walk On through the rain", "!For-your-dreams": "be tossed and blown", "!When-you-walk": "through a storm hold your head up high and don't be afraid of the dark\nAt the end of a Storm there's a golden sky and the sweet silver song of the lark\nWalk on through the wind\nWalk on through the rain, for your dreams be tossed and blown\nWalk On, Walk On with hope in your hearts and You'll Never Walk Alone, **YOU'LL NEVER WALK ALONE**\nWalk On, Walk On with hope in your hearts and You'll Never Walk Alone, **YOU'LL NEVER WALK ALONE**", "!Scotland'sNo1": "Celtic", "/swipe": "not an alt", "!blacklist": "Done! That felt good", "/blacklist": "Done! That felt good", "!sr.c": "https://www.speedrun.com/mcbe", "!h": "<@!199070670221475842> no swearing in this christian discord server", "!lenny": "( \u0361\u00b0 \u035c\u0296 \u0361\u00b0)", "!uwu": "uwu"} \ No newline at end of file
diff --git a/main.py b/main.py
index 9f713bf..9f713bf 100755..100644
--- a/main.py
+++ b/main.py
diff --git a/palette.png b/palette.png
new file mode 100644
index 0000000..973a599
--- /dev/null
+++ b/palette.png
Binary files differ