From 86f3e71d1325bb82842aea7a6588474282b73f83 Mon Sep 17 00:00:00 2001 From: Krypton Date: Sun, 28 Nov 2021 21:14:07 +0100 Subject: [PATCH] Template v4.0.1 * Fixed some *weird* code --- UPDATES.md | 4 ++++ bot.py | 4 ++-- cogs/fun.py | 18 ++---------------- cogs/general.py | 8 ++++---- cogs/moderation.py | 4 ++-- cogs/owner.py | 4 ++-- cogs/template.py | 4 ++-- exceptions/__init__.py | 4 ++-- helpers/checks.py | 4 ++-- helpers/json_manager.py | 4 ++-- 10 files changed, 24 insertions(+), 34 deletions(-) diff --git a/UPDATES.md b/UPDATES.md index a5f963f7..62f28999 100644 --- a/UPDATES.md +++ b/UPDATES.md @@ -2,6 +2,10 @@ Here is the list of all the updates that I made on this template. +### Version 4.0.1 + +* Fixed some *weird* code + ### Version 4.0 * Now using [`disnake`](https://docs.disnake.dev) diff --git a/bot.py b/bot.py index a3910389..8f75a3f8 100644 --- a/bot.py +++ b/bot.py @@ -1,9 +1,9 @@ """" -Copyright © Krypton 2021 - https://github.com/kkrypt0nn +Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk) Description: This is a template to create your own discord bot in python. -Version: 4.0 +Version: 4.0.1 """ import json diff --git a/cogs/fun.py b/cogs/fun.py index 6563c89f..c6249c07 100644 --- a/cogs/fun.py +++ b/cogs/fun.py @@ -1,9 +1,9 @@ """" -Copyright © Krypton 2021 - https://github.com/kkrypt0nn +Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk) Description: This is a template to create your own discord bot in python. -Version: 4.0 +Version: 4.0.1 """ import json @@ -118,13 +118,6 @@ async def randomfact(self, interaction: ApplicationCommandInteraction): """ Get a random fact. """ - - # This is, for now, only temporary - with open("blacklist.json") as file: - blacklist = json.load(file) - if interaction.author.id in blacklist["ids"]: - return - # This will prevent your bot from stopping everything when doing a web request - see: https://discordpy.readthedocs.io/en/stable/faq.html#how-do-i-make-a-web-request async with aiohttp.ClientSession() as session: async with session.get("https://uselessfacts.jsph.pl/random.json?language=en") as request: @@ -151,13 +144,6 @@ async def randomfact(self, context: Context): """ Get a random fact. """ - - # This is, for now, only temporary - with open("blacklist.json") as file: - blacklist = json.load(file) - if context.author.id in blacklist["ids"]: - return - # This will prevent your bot from stopping everything when doing a web request - see: https://discordpy.readthedocs.io/en/stable/faq.html#how-do-i-make-a-web-request async with aiohttp.ClientSession() as session: async with session.get("https://uselessfacts.jsph.pl/random.json?language=en") as request: diff --git a/cogs/general.py b/cogs/general.py index 5da187b6..d0d41286 100644 --- a/cogs/general.py +++ b/cogs/general.py @@ -1,9 +1,9 @@ """" -Copyright © Krypton 2021 - https://github.com/kkrypt0nn +Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk) Description: This is a template to create your own discord bot in python. -Version: 4.0 +Version: 4.0.1 """ import json @@ -325,7 +325,7 @@ async def eight_ball(self, interaction: ApplicationCommandInteraction, question: 'My sources say no.', 'Outlook not so good.', 'Very doubtful.'] embed = disnake.Embed( title="**My Answer:**", - description=f"{answers[random.randint(0, len(answers) - 1)]}", + description=f"{random.choice(answers)}", color=0x9C84EF ) embed.set_footer( @@ -349,7 +349,7 @@ async def eight_ball(self, context: Context, *, question: str): 'My sources say no.', 'Outlook not so good.', 'Very doubtful.'] embed = disnake.Embed( title="**My Answer:**", - description=f"{answers[random.randint(0, len(answers) - 1)]}", + description=f"{random.choice(answers)}", color=0x9C84EF ) embed.set_footer( diff --git a/cogs/moderation.py b/cogs/moderation.py index e831df29..0b4a8aee 100644 --- a/cogs/moderation.py +++ b/cogs/moderation.py @@ -1,9 +1,9 @@ """" -Copyright © Krypton 2021 - https://github.com/kkrypt0nn +Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk) Description: This is a template to create your own discord bot in python. -Version: 4.0 +Version: 4.0.1 """ import json diff --git a/cogs/owner.py b/cogs/owner.py index fb77bf09..7c814f24 100644 --- a/cogs/owner.py +++ b/cogs/owner.py @@ -1,9 +1,9 @@ """" -Copyright © Krypton 2021 - https://github.com/kkrypt0nn +Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk) Description: This is a template to create your own discord bot in python. -Version: 4.0 +Version: 4.0.1 """ import json diff --git a/cogs/template.py b/cogs/template.py index b1ae2328..93385dad 100644 --- a/cogs/template.py +++ b/cogs/template.py @@ -1,9 +1,9 @@ """" -Copyright © Krypton 2021 - https://github.com/kkrypt0nn +Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk) Description: This is a template to create your own discord bot in python. -Version: 4.0 +Version: 4.0.1 """ import json diff --git a/exceptions/__init__.py b/exceptions/__init__.py index efcb3920..e3e6ebf2 100644 --- a/exceptions/__init__.py +++ b/exceptions/__init__.py @@ -1,9 +1,9 @@ """" -Copyright © Krypton 2021 - https://github.com/kkrypt0nn +Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk) Description: This is a template to create your own discord bot in python. -Version: 4.0 +Version: 4.0.1 """ diff --git a/helpers/checks.py b/helpers/checks.py index d9f66590..576fa217 100644 --- a/helpers/checks.py +++ b/helpers/checks.py @@ -1,9 +1,9 @@ """" -Copyright © Krypton 2021 - https://github.com/kkrypt0nn +Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk) Description: This is a template to create your own discord bot in python. -Version: 4.0 +Version: 4.0.1 """ import json diff --git a/helpers/json_manager.py b/helpers/json_manager.py index 0512ca2a..26eb8ad5 100644 --- a/helpers/json_manager.py +++ b/helpers/json_manager.py @@ -1,9 +1,9 @@ """" -Copyright © Krypton 2021 - https://github.com/kkrypt0nn +Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk) Description: This is a template to create your own discord bot in python. -Version: 4.0 +Version: 4.0.1 """ import json