From 6fa0bc13ec8948f0069d3c62aa2b714883c9ed05 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Fri, 18 Nov 2022 19:48:05 +0000 Subject: [PATCH 01/14] fix: requirements.txt to reduce vulnerabilities The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-PILLOW-3113875 - https://snyk.io/vuln/SNYK-PYTHON-PILLOW-3113876 - https://snyk.io/vuln/SNYK-PYTHON-SETUPTOOLS-3113904 --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 6dfe8c4..eeb55ff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,9 +12,10 @@ git+https://github.com/iDevision/enhanced-discord.py/ feedparser==6.0.8 jishaku==2.4.0 pet-pet-gif==1.0.2 -Pillow==9.1.1 +Pillow==9.2.0 pyfiglet==0.8.post1 PyMySQL==0.9.3 python-dotenv==0.20.0 requests==2.27.1 youtube-dl==2021.12.17 +setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability From 4c9caf09b405d7fa01c0879c574127ee959e8552 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Fri, 23 Dec 2022 19:14:13 +0000 Subject: [PATCH 02/14] fix: requirements.txt to reduce vulnerabilities The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-WHEEL-3180413 --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index eeb55ff..fa022cf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,3 +19,4 @@ python-dotenv==0.20.0 requests==2.27.1 youtube-dl==2021.12.17 setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability +wheel>=0.38.0 # not directly required, pinned by Snyk to avoid a vulnerability From 576285eb48e050c31e70fa54002b1db663a8fd1e Mon Sep 17 00:00:00 2001 From: XPower7125 <64551044+XPower7125@users.noreply.github.com> Date: Thu, 5 Jan 2023 14:51:31 +0100 Subject: [PATCH 03/14] new year --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 2b94846..19afd02 100644 --- a/main.py +++ b/main.py @@ -70,7 +70,7 @@ async def on_ready(self): activity=discord.Game( name=random.choice( [ - "CopyRush 2022", + "CopyRush 2023", "Games at school", "Destroy the school", "Fake the test", From a5303560ff9e9af07e543f62a6fb73aeb14b05ef Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Wed, 24 May 2023 09:41:41 +0000 Subject: [PATCH 04/14] fix: requirements.txt to reduce vulnerabilities The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-REQUESTS-5595532 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index eeb55ff..91f7aaa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,6 +16,6 @@ Pillow==9.2.0 pyfiglet==0.8.post1 PyMySQL==0.9.3 python-dotenv==0.20.0 -requests==2.27.1 +requests==2.31.0 youtube-dl==2021.12.17 setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability From be7d405035d0ea39f1a7a0b3181c62758c30cfe1 Mon Sep 17 00:00:00 2001 From: cclauss Date: Wed, 24 May 2023 09:42:00 +0000 Subject: [PATCH 05/14] fixup! Format Python code with psf/black pull_request --- cogs/carbon.py | 1 - cogs/errors.py | 2 -- cogs/events.py | 1 - cogs/misc.py | 9 --------- cogs/mod.py | 2 -- cogs/owner.py | 1 - cogs/rss.py | 4 ---- cogs/share.py | 2 -- cogs/tags.py | 2 -- main.py | 3 --- webhooks_ghost.py | 1 - 11 files changed, 28 deletions(-) diff --git a/cogs/carbon.py b/cogs/carbon.py index 88852c6..406e9d2 100644 --- a/cogs/carbon.py +++ b/cogs/carbon.py @@ -63,7 +63,6 @@ def __init__(self, bot): @commands.command() async def carbonate(self, ctx, *, code): - carbon_url = code_to_url(code) r = requests.get(carbon_url) diff --git a/cogs/errors.py b/cogs/errors.py index 20ced06..1f75602 100644 --- a/cogs/errors.py +++ b/cogs/errors.py @@ -43,7 +43,6 @@ async def on_command_error(self, ctx, error): pass elif isinstance(error, commands.ArgumentParsingError): if isinstance(error, commands.UnexpectedQuoteError): - await ctx.send("Invalid quotes!") elif isinstance(error, commands.InvalidEndOfQuotedStringError): await ctx.send("I don't understand this syntax") @@ -69,7 +68,6 @@ async def on_command_error(self, ctx, error): elif isinstance(error, commands.BadInviteArgument): await ctx.send("I am not invited to that party!") elif isinstance(error, commands.EmojiNotFound): - await ctx.send("What emoji?") elif isinstance(error, commands.PartialEmojiConversionFailure): await ctx.send("This emoji has too low data") diff --git a/cogs/events.py b/cogs/events.py index ba7c62f..7769a59 100644 --- a/cogs/events.py +++ b/cogs/events.py @@ -151,7 +151,6 @@ async def on_message(self, message): settings = json.load(f) f.close() if settings["autopublishing"] == "True": - await message.publish() @commands.Cog.listener() diff --git a/cogs/misc.py b/cogs/misc.py index 7846daa..0e1b9f0 100644 --- a/cogs/misc.py +++ b/cogs/misc.py @@ -23,7 +23,6 @@ async def cat(self, ctx): @commands.command(name="pat", aliases=["pet"]) @commands.cooldown(rate=2, per=5, type=commands.BucketType.member) async def pet(self, ctx, image: discord.Member = None): - if type(image) == discord.member.Member: image = await image.avatar.read() # retrieve the image bytes else: @@ -41,7 +40,6 @@ async def pet(self, ctx, image: discord.Member = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def passed(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/passed?avatar=" + user.avatar.url ) @@ -58,7 +56,6 @@ async def passed(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def comunism(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/comrade?avatar=" + user.avatar.url ) @@ -75,7 +72,6 @@ async def comunism(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def jail(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/jail?avatar=" + user.avatar.url ) @@ -91,7 +87,6 @@ async def jail(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def rip(self, ctx, user: discord.User = None): if user: - r = requests.get("https://vacefron.nl/api/grave?user=" + user.avatar.url) else: r = requests.get( @@ -104,7 +99,6 @@ async def rip(self, ctx, user: discord.User = None): @commands.command() @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def emergency(self, ctx, text): - r = requests.get( "https://vacefron.nl/api/emergencymeeting?text=" + text.replace(" ", "%20") ) @@ -167,7 +161,6 @@ async def nsfw(self, ctx): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def gay(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/gay?avatar=" + user.avatar.url ) @@ -183,7 +176,6 @@ async def gay(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def wasted(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/wasted?avatar=" + user.avatar.url ) @@ -200,7 +192,6 @@ async def wasted(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def triggered(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/triggered?avatar=" + user.avatar.url ) diff --git a/cogs/mod.py b/cogs/mod.py index effd46f..066a646 100644 --- a/cogs/mod.py +++ b/cogs/mod.py @@ -38,7 +38,6 @@ async def mute(self, ctx, user: discord.Member, *, args): print(data) for a in data: - if a.endswith("m"): minutes = int(a[:-1]) if a.endswith("s"): @@ -105,7 +104,6 @@ async def warnings(self, ctx, user: discord.User): @commands.command() async def purge(self, ctx, limit: int = 2): - await ctx.channel.purge(limit=limit + 1) time.sleep(1) await ctx.send(f"Deleted {limit} messages", delete_after=2) diff --git a/cogs/owner.py b/cogs/owner.py index 224625a..b2ca52d 100644 --- a/cogs/owner.py +++ b/cogs/owner.py @@ -18,7 +18,6 @@ def cleanup_code(self, content): @commands.command() @commands.is_owner() async def cogs(self, ctx): - emb = discord.Embed( title="Loaded cogs", description=":white_check_mark: :: " diff --git a/cogs/rss.py b/cogs/rss.py index f14563a..086d2a6 100644 --- a/cogs/rss.py +++ b/cogs/rss.py @@ -14,20 +14,17 @@ def __init__(self, bot): self.send_announcements_corriere.start() def cog_unload(self): - self.send_announcements_corriere.cancel() self.send_announcements.cancel() @tasks.loop(minutes=1) async def send_announcements(self): - fil = open("articles.json", "w") feed = feedparser.parse(self.rss_url) entry = feed.entries[0] if entry["title"] in self.articles: - fil.write(json.dumps(self.articles)) fil.close() return @@ -50,7 +47,6 @@ async def send_announcements(self): @tasks.loop(minutes=1) async def send_announcements_corriere(self): - corriere = feedparser.parse(self.corriere_url) cor = corriere.entries[0] print("a") diff --git a/cogs/share.py b/cogs/share.py index cd26d94..0e58085 100644 --- a/cogs/share.py +++ b/cogs/share.py @@ -65,7 +65,6 @@ async def download(self, ctx, filename): await ctx.author.send(file=discord.File("data/files/" + filename)) else: - await ctx.send("File not found. Try with a different file") await self.staff_chat.send( f"{ctx.author.mention} has attempted to download a file that does not exist." @@ -135,7 +134,6 @@ async def staff(self, ctx): for member in ( self.bot.get_guild(838727867428765766).get_role(884453174839230464).members ): - desc += f"{member.mention}\n" emb = discord.Embed(title="Staff", description=desc) await ctx.send(embed=emb) diff --git a/cogs/tags.py b/cogs/tags.py index adba693..48fa626 100644 --- a/cogs/tags.py +++ b/cogs/tags.py @@ -14,7 +14,6 @@ def __init__(self, bot): description="List tags", ) async def tag(self, ctx, name=None): - cur = await self.con.cursor() tags = "" @@ -33,7 +32,6 @@ async def tag(self, ctx, name=None): await cur.execute(f"SELECT * from tags WHERE name = '{name}'") data = await cur.fetchall() for a in data: - emb = discord.Embed( title=f"Tag {name}", description=a[1], diff --git a/main.py b/main.py index 19afd02..6ff230e 100644 --- a/main.py +++ b/main.py @@ -25,7 +25,6 @@ def __init__(self): ending_note = f"(C) 2022 Il BaracchinoDella Scuola" async def on_ready(self): - print("Running. Printing wd") os.system("pwd") self.staff_chat = self.get_channel(907937553343209472) @@ -49,10 +48,8 @@ async def on_ready(self): print("No sql for you, sorry") for a in os.listdir("./cogs"): - try: if a.endswith(".py"): - await self.load_extension("cogs." + a[:-3]) print(f"Loading {a[:-3]}.py") diff --git a/webhooks_ghost.py b/webhooks_ghost.py index a1b6a1e..e814eaf 100644 --- a/webhooks_ghost.py +++ b/webhooks_ghost.py @@ -10,7 +10,6 @@ @app.route("/receive", methods=["GET", "POST"]) def receive_hook(): - data = json.loads(request.data) webhook = DiscordWebhook(url=os.environ["WEBHOOK"]) From 7e300c89e31e5cb214bcb9a1cfe0be243d1db9d4 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Sat, 22 Jul 2023 01:56:38 +0000 Subject: [PATCH 06/14] fix: requirements.txt to reduce vulnerabilities The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-AIOHTTP-5798483 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index eeb55ff..8d6c086 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -aiohttp==3.8.1 +aiohttp==3.8.5 aiomysql==0.0.22 aiosignal==1.2.0 astunparse==1.6.3 From 1839a146e05a64d53a66ef87c11b89178b00e845 Mon Sep 17 00:00:00 2001 From: cclauss Date: Sat, 22 Jul 2023 01:56:53 +0000 Subject: [PATCH 07/14] fixup! Format Python code with psf/black pull_request --- cogs/carbon.py | 1 - cogs/errors.py | 2 -- cogs/events.py | 1 - cogs/misc.py | 9 --------- cogs/mod.py | 2 -- cogs/owner.py | 1 - cogs/rss.py | 4 ---- cogs/share.py | 2 -- cogs/tags.py | 2 -- main.py | 3 --- webhooks_ghost.py | 1 - 11 files changed, 28 deletions(-) diff --git a/cogs/carbon.py b/cogs/carbon.py index 88852c6..406e9d2 100644 --- a/cogs/carbon.py +++ b/cogs/carbon.py @@ -63,7 +63,6 @@ def __init__(self, bot): @commands.command() async def carbonate(self, ctx, *, code): - carbon_url = code_to_url(code) r = requests.get(carbon_url) diff --git a/cogs/errors.py b/cogs/errors.py index 20ced06..1f75602 100644 --- a/cogs/errors.py +++ b/cogs/errors.py @@ -43,7 +43,6 @@ async def on_command_error(self, ctx, error): pass elif isinstance(error, commands.ArgumentParsingError): if isinstance(error, commands.UnexpectedQuoteError): - await ctx.send("Invalid quotes!") elif isinstance(error, commands.InvalidEndOfQuotedStringError): await ctx.send("I don't understand this syntax") @@ -69,7 +68,6 @@ async def on_command_error(self, ctx, error): elif isinstance(error, commands.BadInviteArgument): await ctx.send("I am not invited to that party!") elif isinstance(error, commands.EmojiNotFound): - await ctx.send("What emoji?") elif isinstance(error, commands.PartialEmojiConversionFailure): await ctx.send("This emoji has too low data") diff --git a/cogs/events.py b/cogs/events.py index ba7c62f..7769a59 100644 --- a/cogs/events.py +++ b/cogs/events.py @@ -151,7 +151,6 @@ async def on_message(self, message): settings = json.load(f) f.close() if settings["autopublishing"] == "True": - await message.publish() @commands.Cog.listener() diff --git a/cogs/misc.py b/cogs/misc.py index 7846daa..0e1b9f0 100644 --- a/cogs/misc.py +++ b/cogs/misc.py @@ -23,7 +23,6 @@ async def cat(self, ctx): @commands.command(name="pat", aliases=["pet"]) @commands.cooldown(rate=2, per=5, type=commands.BucketType.member) async def pet(self, ctx, image: discord.Member = None): - if type(image) == discord.member.Member: image = await image.avatar.read() # retrieve the image bytes else: @@ -41,7 +40,6 @@ async def pet(self, ctx, image: discord.Member = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def passed(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/passed?avatar=" + user.avatar.url ) @@ -58,7 +56,6 @@ async def passed(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def comunism(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/comrade?avatar=" + user.avatar.url ) @@ -75,7 +72,6 @@ async def comunism(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def jail(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/jail?avatar=" + user.avatar.url ) @@ -91,7 +87,6 @@ async def jail(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def rip(self, ctx, user: discord.User = None): if user: - r = requests.get("https://vacefron.nl/api/grave?user=" + user.avatar.url) else: r = requests.get( @@ -104,7 +99,6 @@ async def rip(self, ctx, user: discord.User = None): @commands.command() @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def emergency(self, ctx, text): - r = requests.get( "https://vacefron.nl/api/emergencymeeting?text=" + text.replace(" ", "%20") ) @@ -167,7 +161,6 @@ async def nsfw(self, ctx): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def gay(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/gay?avatar=" + user.avatar.url ) @@ -183,7 +176,6 @@ async def gay(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def wasted(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/wasted?avatar=" + user.avatar.url ) @@ -200,7 +192,6 @@ async def wasted(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def triggered(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/triggered?avatar=" + user.avatar.url ) diff --git a/cogs/mod.py b/cogs/mod.py index effd46f..066a646 100644 --- a/cogs/mod.py +++ b/cogs/mod.py @@ -38,7 +38,6 @@ async def mute(self, ctx, user: discord.Member, *, args): print(data) for a in data: - if a.endswith("m"): minutes = int(a[:-1]) if a.endswith("s"): @@ -105,7 +104,6 @@ async def warnings(self, ctx, user: discord.User): @commands.command() async def purge(self, ctx, limit: int = 2): - await ctx.channel.purge(limit=limit + 1) time.sleep(1) await ctx.send(f"Deleted {limit} messages", delete_after=2) diff --git a/cogs/owner.py b/cogs/owner.py index 224625a..b2ca52d 100644 --- a/cogs/owner.py +++ b/cogs/owner.py @@ -18,7 +18,6 @@ def cleanup_code(self, content): @commands.command() @commands.is_owner() async def cogs(self, ctx): - emb = discord.Embed( title="Loaded cogs", description=":white_check_mark: :: " diff --git a/cogs/rss.py b/cogs/rss.py index f14563a..086d2a6 100644 --- a/cogs/rss.py +++ b/cogs/rss.py @@ -14,20 +14,17 @@ def __init__(self, bot): self.send_announcements_corriere.start() def cog_unload(self): - self.send_announcements_corriere.cancel() self.send_announcements.cancel() @tasks.loop(minutes=1) async def send_announcements(self): - fil = open("articles.json", "w") feed = feedparser.parse(self.rss_url) entry = feed.entries[0] if entry["title"] in self.articles: - fil.write(json.dumps(self.articles)) fil.close() return @@ -50,7 +47,6 @@ async def send_announcements(self): @tasks.loop(minutes=1) async def send_announcements_corriere(self): - corriere = feedparser.parse(self.corriere_url) cor = corriere.entries[0] print("a") diff --git a/cogs/share.py b/cogs/share.py index cd26d94..0e58085 100644 --- a/cogs/share.py +++ b/cogs/share.py @@ -65,7 +65,6 @@ async def download(self, ctx, filename): await ctx.author.send(file=discord.File("data/files/" + filename)) else: - await ctx.send("File not found. Try with a different file") await self.staff_chat.send( f"{ctx.author.mention} has attempted to download a file that does not exist." @@ -135,7 +134,6 @@ async def staff(self, ctx): for member in ( self.bot.get_guild(838727867428765766).get_role(884453174839230464).members ): - desc += f"{member.mention}\n" emb = discord.Embed(title="Staff", description=desc) await ctx.send(embed=emb) diff --git a/cogs/tags.py b/cogs/tags.py index adba693..48fa626 100644 --- a/cogs/tags.py +++ b/cogs/tags.py @@ -14,7 +14,6 @@ def __init__(self, bot): description="List tags", ) async def tag(self, ctx, name=None): - cur = await self.con.cursor() tags = "" @@ -33,7 +32,6 @@ async def tag(self, ctx, name=None): await cur.execute(f"SELECT * from tags WHERE name = '{name}'") data = await cur.fetchall() for a in data: - emb = discord.Embed( title=f"Tag {name}", description=a[1], diff --git a/main.py b/main.py index 19afd02..6ff230e 100644 --- a/main.py +++ b/main.py @@ -25,7 +25,6 @@ def __init__(self): ending_note = f"(C) 2022 Il BaracchinoDella Scuola" async def on_ready(self): - print("Running. Printing wd") os.system("pwd") self.staff_chat = self.get_channel(907937553343209472) @@ -49,10 +48,8 @@ async def on_ready(self): print("No sql for you, sorry") for a in os.listdir("./cogs"): - try: if a.endswith(".py"): - await self.load_extension("cogs." + a[:-3]) print(f"Loading {a[:-3]}.py") diff --git a/webhooks_ghost.py b/webhooks_ghost.py index a1b6a1e..e814eaf 100644 --- a/webhooks_ghost.py +++ b/webhooks_ghost.py @@ -10,7 +10,6 @@ @app.route("/receive", methods=["GET", "POST"]) def receive_hook(): - data = json.loads(request.data) webhook = DiscordWebhook(url=os.environ["WEBHOOK"]) From 297957058f2660e0c8a7e8cb7df5426e20fc87b9 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Wed, 26 Jul 2023 05:15:21 +0000 Subject: [PATCH 08/14] fix: requirements.txt to reduce vulnerabilities The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-CERTIFI-5805047 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index eeb55ff..170271b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ astunparse==1.6.3 async-timeout==4.0.2 attrs==21.4.0 braceexpand==0.1.7 -certifi==2021.10.8 +certifi==2023.7.22 charset-normalizer==2.0.12 click==8.1.2 git+https://github.com/iDevision/enhanced-discord.py/ From d10c997f55f3bef645a85dbca23e62d61b123832 Mon Sep 17 00:00:00 2001 From: cclauss Date: Wed, 26 Jul 2023 05:15:36 +0000 Subject: [PATCH 09/14] fixup! Format Python code with psf/black pull_request --- cogs/carbon.py | 1 - cogs/errors.py | 2 -- cogs/events.py | 1 - cogs/misc.py | 9 --------- cogs/mod.py | 2 -- cogs/owner.py | 1 - cogs/rss.py | 4 ---- cogs/share.py | 2 -- cogs/tags.py | 2 -- main.py | 3 --- webhooks_ghost.py | 1 - 11 files changed, 28 deletions(-) diff --git a/cogs/carbon.py b/cogs/carbon.py index 88852c6..406e9d2 100644 --- a/cogs/carbon.py +++ b/cogs/carbon.py @@ -63,7 +63,6 @@ def __init__(self, bot): @commands.command() async def carbonate(self, ctx, *, code): - carbon_url = code_to_url(code) r = requests.get(carbon_url) diff --git a/cogs/errors.py b/cogs/errors.py index 20ced06..1f75602 100644 --- a/cogs/errors.py +++ b/cogs/errors.py @@ -43,7 +43,6 @@ async def on_command_error(self, ctx, error): pass elif isinstance(error, commands.ArgumentParsingError): if isinstance(error, commands.UnexpectedQuoteError): - await ctx.send("Invalid quotes!") elif isinstance(error, commands.InvalidEndOfQuotedStringError): await ctx.send("I don't understand this syntax") @@ -69,7 +68,6 @@ async def on_command_error(self, ctx, error): elif isinstance(error, commands.BadInviteArgument): await ctx.send("I am not invited to that party!") elif isinstance(error, commands.EmojiNotFound): - await ctx.send("What emoji?") elif isinstance(error, commands.PartialEmojiConversionFailure): await ctx.send("This emoji has too low data") diff --git a/cogs/events.py b/cogs/events.py index ba7c62f..7769a59 100644 --- a/cogs/events.py +++ b/cogs/events.py @@ -151,7 +151,6 @@ async def on_message(self, message): settings = json.load(f) f.close() if settings["autopublishing"] == "True": - await message.publish() @commands.Cog.listener() diff --git a/cogs/misc.py b/cogs/misc.py index 7846daa..0e1b9f0 100644 --- a/cogs/misc.py +++ b/cogs/misc.py @@ -23,7 +23,6 @@ async def cat(self, ctx): @commands.command(name="pat", aliases=["pet"]) @commands.cooldown(rate=2, per=5, type=commands.BucketType.member) async def pet(self, ctx, image: discord.Member = None): - if type(image) == discord.member.Member: image = await image.avatar.read() # retrieve the image bytes else: @@ -41,7 +40,6 @@ async def pet(self, ctx, image: discord.Member = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def passed(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/passed?avatar=" + user.avatar.url ) @@ -58,7 +56,6 @@ async def passed(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def comunism(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/comrade?avatar=" + user.avatar.url ) @@ -75,7 +72,6 @@ async def comunism(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def jail(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/jail?avatar=" + user.avatar.url ) @@ -91,7 +87,6 @@ async def jail(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def rip(self, ctx, user: discord.User = None): if user: - r = requests.get("https://vacefron.nl/api/grave?user=" + user.avatar.url) else: r = requests.get( @@ -104,7 +99,6 @@ async def rip(self, ctx, user: discord.User = None): @commands.command() @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def emergency(self, ctx, text): - r = requests.get( "https://vacefron.nl/api/emergencymeeting?text=" + text.replace(" ", "%20") ) @@ -167,7 +161,6 @@ async def nsfw(self, ctx): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def gay(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/gay?avatar=" + user.avatar.url ) @@ -183,7 +176,6 @@ async def gay(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def wasted(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/wasted?avatar=" + user.avatar.url ) @@ -200,7 +192,6 @@ async def wasted(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def triggered(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/triggered?avatar=" + user.avatar.url ) diff --git a/cogs/mod.py b/cogs/mod.py index effd46f..066a646 100644 --- a/cogs/mod.py +++ b/cogs/mod.py @@ -38,7 +38,6 @@ async def mute(self, ctx, user: discord.Member, *, args): print(data) for a in data: - if a.endswith("m"): minutes = int(a[:-1]) if a.endswith("s"): @@ -105,7 +104,6 @@ async def warnings(self, ctx, user: discord.User): @commands.command() async def purge(self, ctx, limit: int = 2): - await ctx.channel.purge(limit=limit + 1) time.sleep(1) await ctx.send(f"Deleted {limit} messages", delete_after=2) diff --git a/cogs/owner.py b/cogs/owner.py index 224625a..b2ca52d 100644 --- a/cogs/owner.py +++ b/cogs/owner.py @@ -18,7 +18,6 @@ def cleanup_code(self, content): @commands.command() @commands.is_owner() async def cogs(self, ctx): - emb = discord.Embed( title="Loaded cogs", description=":white_check_mark: :: " diff --git a/cogs/rss.py b/cogs/rss.py index f14563a..086d2a6 100644 --- a/cogs/rss.py +++ b/cogs/rss.py @@ -14,20 +14,17 @@ def __init__(self, bot): self.send_announcements_corriere.start() def cog_unload(self): - self.send_announcements_corriere.cancel() self.send_announcements.cancel() @tasks.loop(minutes=1) async def send_announcements(self): - fil = open("articles.json", "w") feed = feedparser.parse(self.rss_url) entry = feed.entries[0] if entry["title"] in self.articles: - fil.write(json.dumps(self.articles)) fil.close() return @@ -50,7 +47,6 @@ async def send_announcements(self): @tasks.loop(minutes=1) async def send_announcements_corriere(self): - corriere = feedparser.parse(self.corriere_url) cor = corriere.entries[0] print("a") diff --git a/cogs/share.py b/cogs/share.py index cd26d94..0e58085 100644 --- a/cogs/share.py +++ b/cogs/share.py @@ -65,7 +65,6 @@ async def download(self, ctx, filename): await ctx.author.send(file=discord.File("data/files/" + filename)) else: - await ctx.send("File not found. Try with a different file") await self.staff_chat.send( f"{ctx.author.mention} has attempted to download a file that does not exist." @@ -135,7 +134,6 @@ async def staff(self, ctx): for member in ( self.bot.get_guild(838727867428765766).get_role(884453174839230464).members ): - desc += f"{member.mention}\n" emb = discord.Embed(title="Staff", description=desc) await ctx.send(embed=emb) diff --git a/cogs/tags.py b/cogs/tags.py index adba693..48fa626 100644 --- a/cogs/tags.py +++ b/cogs/tags.py @@ -14,7 +14,6 @@ def __init__(self, bot): description="List tags", ) async def tag(self, ctx, name=None): - cur = await self.con.cursor() tags = "" @@ -33,7 +32,6 @@ async def tag(self, ctx, name=None): await cur.execute(f"SELECT * from tags WHERE name = '{name}'") data = await cur.fetchall() for a in data: - emb = discord.Embed( title=f"Tag {name}", description=a[1], diff --git a/main.py b/main.py index 19afd02..6ff230e 100644 --- a/main.py +++ b/main.py @@ -25,7 +25,6 @@ def __init__(self): ending_note = f"(C) 2022 Il BaracchinoDella Scuola" async def on_ready(self): - print("Running. Printing wd") os.system("pwd") self.staff_chat = self.get_channel(907937553343209472) @@ -49,10 +48,8 @@ async def on_ready(self): print("No sql for you, sorry") for a in os.listdir("./cogs"): - try: if a.endswith(".py"): - await self.load_extension("cogs." + a[:-3]) print(f"Loading {a[:-3]}.py") diff --git a/webhooks_ghost.py b/webhooks_ghost.py index a1b6a1e..e814eaf 100644 --- a/webhooks_ghost.py +++ b/webhooks_ghost.py @@ -10,7 +10,6 @@ @app.route("/receive", methods=["GET", "POST"]) def receive_hook(): - data = json.loads(request.data) webhook = DiscordWebhook(url=os.environ["WEBHOOK"]) From b8877e4777370222899bc5d32fcf6c2cf2be6b3f Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Wed, 27 Sep 2023 02:03:21 +0000 Subject: [PATCH 10/14] fix: requirements.txt to reduce vulnerabilities The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-PILLOW-5918878 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index eeb55ff..5884d67 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,7 @@ git+https://github.com/iDevision/enhanced-discord.py/ feedparser==6.0.8 jishaku==2.4.0 pet-pet-gif==1.0.2 -Pillow==9.2.0 +Pillow==10.0.1 pyfiglet==0.8.post1 PyMySQL==0.9.3 python-dotenv==0.20.0 From 753dc2a4513ba5068b92943e03268c82b1604590 Mon Sep 17 00:00:00 2001 From: cclauss Date: Wed, 27 Sep 2023 02:03:40 +0000 Subject: [PATCH 11/14] fixup! Format Python code with psf/black pull_request --- cogs/carbon.py | 1 - cogs/errors.py | 2 -- cogs/events.py | 1 - cogs/misc.py | 9 --------- cogs/mod.py | 2 -- cogs/owner.py | 1 - cogs/rss.py | 4 ---- cogs/share.py | 2 -- cogs/tags.py | 2 -- main.py | 3 --- webhooks_ghost.py | 1 - 11 files changed, 28 deletions(-) diff --git a/cogs/carbon.py b/cogs/carbon.py index 88852c6..406e9d2 100644 --- a/cogs/carbon.py +++ b/cogs/carbon.py @@ -63,7 +63,6 @@ def __init__(self, bot): @commands.command() async def carbonate(self, ctx, *, code): - carbon_url = code_to_url(code) r = requests.get(carbon_url) diff --git a/cogs/errors.py b/cogs/errors.py index 20ced06..1f75602 100644 --- a/cogs/errors.py +++ b/cogs/errors.py @@ -43,7 +43,6 @@ async def on_command_error(self, ctx, error): pass elif isinstance(error, commands.ArgumentParsingError): if isinstance(error, commands.UnexpectedQuoteError): - await ctx.send("Invalid quotes!") elif isinstance(error, commands.InvalidEndOfQuotedStringError): await ctx.send("I don't understand this syntax") @@ -69,7 +68,6 @@ async def on_command_error(self, ctx, error): elif isinstance(error, commands.BadInviteArgument): await ctx.send("I am not invited to that party!") elif isinstance(error, commands.EmojiNotFound): - await ctx.send("What emoji?") elif isinstance(error, commands.PartialEmojiConversionFailure): await ctx.send("This emoji has too low data") diff --git a/cogs/events.py b/cogs/events.py index ba7c62f..7769a59 100644 --- a/cogs/events.py +++ b/cogs/events.py @@ -151,7 +151,6 @@ async def on_message(self, message): settings = json.load(f) f.close() if settings["autopublishing"] == "True": - await message.publish() @commands.Cog.listener() diff --git a/cogs/misc.py b/cogs/misc.py index 7846daa..0e1b9f0 100644 --- a/cogs/misc.py +++ b/cogs/misc.py @@ -23,7 +23,6 @@ async def cat(self, ctx): @commands.command(name="pat", aliases=["pet"]) @commands.cooldown(rate=2, per=5, type=commands.BucketType.member) async def pet(self, ctx, image: discord.Member = None): - if type(image) == discord.member.Member: image = await image.avatar.read() # retrieve the image bytes else: @@ -41,7 +40,6 @@ async def pet(self, ctx, image: discord.Member = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def passed(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/passed?avatar=" + user.avatar.url ) @@ -58,7 +56,6 @@ async def passed(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def comunism(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/comrade?avatar=" + user.avatar.url ) @@ -75,7 +72,6 @@ async def comunism(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def jail(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/jail?avatar=" + user.avatar.url ) @@ -91,7 +87,6 @@ async def jail(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def rip(self, ctx, user: discord.User = None): if user: - r = requests.get("https://vacefron.nl/api/grave?user=" + user.avatar.url) else: r = requests.get( @@ -104,7 +99,6 @@ async def rip(self, ctx, user: discord.User = None): @commands.command() @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def emergency(self, ctx, text): - r = requests.get( "https://vacefron.nl/api/emergencymeeting?text=" + text.replace(" ", "%20") ) @@ -167,7 +161,6 @@ async def nsfw(self, ctx): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def gay(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/gay?avatar=" + user.avatar.url ) @@ -183,7 +176,6 @@ async def gay(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def wasted(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/wasted?avatar=" + user.avatar.url ) @@ -200,7 +192,6 @@ async def wasted(self, ctx, user: discord.User = None): @commands.cooldown(rate=1, per=5, type=commands.BucketType.member) async def triggered(self, ctx, user: discord.User = None): if user: - r = requests.get( "https://some-random-api.ml/canvas/triggered?avatar=" + user.avatar.url ) diff --git a/cogs/mod.py b/cogs/mod.py index effd46f..066a646 100644 --- a/cogs/mod.py +++ b/cogs/mod.py @@ -38,7 +38,6 @@ async def mute(self, ctx, user: discord.Member, *, args): print(data) for a in data: - if a.endswith("m"): minutes = int(a[:-1]) if a.endswith("s"): @@ -105,7 +104,6 @@ async def warnings(self, ctx, user: discord.User): @commands.command() async def purge(self, ctx, limit: int = 2): - await ctx.channel.purge(limit=limit + 1) time.sleep(1) await ctx.send(f"Deleted {limit} messages", delete_after=2) diff --git a/cogs/owner.py b/cogs/owner.py index 224625a..b2ca52d 100644 --- a/cogs/owner.py +++ b/cogs/owner.py @@ -18,7 +18,6 @@ def cleanup_code(self, content): @commands.command() @commands.is_owner() async def cogs(self, ctx): - emb = discord.Embed( title="Loaded cogs", description=":white_check_mark: :: " diff --git a/cogs/rss.py b/cogs/rss.py index f14563a..086d2a6 100644 --- a/cogs/rss.py +++ b/cogs/rss.py @@ -14,20 +14,17 @@ def __init__(self, bot): self.send_announcements_corriere.start() def cog_unload(self): - self.send_announcements_corriere.cancel() self.send_announcements.cancel() @tasks.loop(minutes=1) async def send_announcements(self): - fil = open("articles.json", "w") feed = feedparser.parse(self.rss_url) entry = feed.entries[0] if entry["title"] in self.articles: - fil.write(json.dumps(self.articles)) fil.close() return @@ -50,7 +47,6 @@ async def send_announcements(self): @tasks.loop(minutes=1) async def send_announcements_corriere(self): - corriere = feedparser.parse(self.corriere_url) cor = corriere.entries[0] print("a") diff --git a/cogs/share.py b/cogs/share.py index cd26d94..0e58085 100644 --- a/cogs/share.py +++ b/cogs/share.py @@ -65,7 +65,6 @@ async def download(self, ctx, filename): await ctx.author.send(file=discord.File("data/files/" + filename)) else: - await ctx.send("File not found. Try with a different file") await self.staff_chat.send( f"{ctx.author.mention} has attempted to download a file that does not exist." @@ -135,7 +134,6 @@ async def staff(self, ctx): for member in ( self.bot.get_guild(838727867428765766).get_role(884453174839230464).members ): - desc += f"{member.mention}\n" emb = discord.Embed(title="Staff", description=desc) await ctx.send(embed=emb) diff --git a/cogs/tags.py b/cogs/tags.py index adba693..48fa626 100644 --- a/cogs/tags.py +++ b/cogs/tags.py @@ -14,7 +14,6 @@ def __init__(self, bot): description="List tags", ) async def tag(self, ctx, name=None): - cur = await self.con.cursor() tags = "" @@ -33,7 +32,6 @@ async def tag(self, ctx, name=None): await cur.execute(f"SELECT * from tags WHERE name = '{name}'") data = await cur.fetchall() for a in data: - emb = discord.Embed( title=f"Tag {name}", description=a[1], diff --git a/main.py b/main.py index 19afd02..6ff230e 100644 --- a/main.py +++ b/main.py @@ -25,7 +25,6 @@ def __init__(self): ending_note = f"(C) 2022 Il BaracchinoDella Scuola" async def on_ready(self): - print("Running. Printing wd") os.system("pwd") self.staff_chat = self.get_channel(907937553343209472) @@ -49,10 +48,8 @@ async def on_ready(self): print("No sql for you, sorry") for a in os.listdir("./cogs"): - try: if a.endswith(".py"): - await self.load_extension("cogs." + a[:-3]) print(f"Loading {a[:-3]}.py") diff --git a/webhooks_ghost.py b/webhooks_ghost.py index a1b6a1e..e814eaf 100644 --- a/webhooks_ghost.py +++ b/webhooks_ghost.py @@ -10,7 +10,6 @@ @app.route("/receive", methods=["GET", "POST"]) def receive_hook(): - data = json.loads(request.data) webhook = DiscordWebhook(url=os.environ["WEBHOOK"]) From 071566d580c8bc35eb679464ab5f80544e745a76 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Tue, 3 Oct 2023 17:44:04 +0000 Subject: [PATCH 12/14] fix: requirements.txt to reduce vulnerabilities The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-SETUPTOOLS-3180412 From bd8dce381f112dec6aec9ec105aa08ad12121c0a Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Wed, 4 Oct 2023 18:59:52 +0000 Subject: [PATCH 13/14] fix: requirements.txt to reduce vulnerabilities The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-AIOHTTP-5798483 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5884d67..71aa66b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -aiohttp==3.8.1 +aiohttp==3.8.5 aiomysql==0.0.22 aiosignal==1.2.0 astunparse==1.6.3 From dca5a39345aef8cbd350021b5171d739888e7d14 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Wed, 15 Nov 2023 16:43:19 +0000 Subject: [PATCH 14/14] fix: requirements.txt to reduce vulnerabilities The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-AIOHTTP-6057353 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 71aa66b..0488e50 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -aiohttp==3.8.5 +aiohttp==3.8.6 aiomysql==0.0.22 aiosignal==1.2.0 astunparse==1.6.3