aboutsummaryrefslogtreecommitdiff
path: root/cogs
diff options
context:
space:
mode:
authorAnInternetTroll <lucafulger@gmail.com>2020-06-03 12:24:12 +0000
committerAnInternetTroll <lucafulger@gmail.com>2020-06-03 12:24:12 +0000
commit5e2f2c37c3012d70037374ff1a06b0fbaef93fcf (patch)
treef153b8db715c5b108a269ba68317dab2e17c130c /cogs
parent29921b0d9a5a5a719669c4772dcafa4ab3c786e1 (diff)
downloadsteve-bot-5e2f2c37c3012d70037374ff1a06b0fbaef93fcf.tar
steve-bot-5e2f2c37c3012d70037374ff1a06b0fbaef93fcf.tar.gz
steve-bot-5e2f2c37c3012d70037374ff1a06b0fbaef93fcf.tar.bz2
steve-bot-5e2f2c37c3012d70037374ff1a06b0fbaef93fcf.tar.lz
steve-bot-5e2f2c37c3012d70037374ff1a06b0fbaef93fcf.tar.xz
steve-bot-5e2f2c37c3012d70037374ff1a06b0fbaef93fcf.tar.zst
steve-bot-5e2f2c37c3012d70037374ff1a06b0fbaef93fcf.zip
General improvements
Diffstat (limited to '')
-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
7 files changed, 53 insertions, 3 deletions
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