diff options
-rw-r--r-- | bot/exts/valentines/be_my_valentine.py | 11 | ||||
-rw-r--r-- | bot/exts/valentines/lovecalculator.py | 9 | ||||
-rw-r--r-- | bot/exts/valentines/movie_generator.py | 4 | ||||
-rw-r--r-- | bot/exts/valentines/myvalenstate.py | 7 | ||||
-rw-r--r-- | bot/exts/valentines/pickuplines.py | 8 | ||||
-rw-r--r-- | bot/exts/valentines/savethedate.py | 8 | ||||
-rw-r--r-- | bot/exts/valentines/valentine_zodiac.py | 8 | ||||
-rw-r--r-- | bot/exts/valentines/whoisvalentine.py | 8 |
8 files changed, 30 insertions, 33 deletions
diff --git a/bot/exts/valentines/be_my_valentine.py b/bot/exts/valentines/be_my_valentine.py index 09591cf8..051f09b8 100644 --- a/bot/exts/valentines/be_my_valentine.py +++ b/bot/exts/valentines/be_my_valentine.py @@ -8,6 +8,7 @@ import discord from discord.ext import commands from discord.ext.commands.cooldowns import BucketType +from bot.bot import Bot from bot.constants import Channels, Colours, Lovefest, Month from bot.utils.decorators import in_month from bot.utils.extensions import invoke_help_command @@ -50,7 +51,7 @@ class BeMyValentine(commands.Cog): async def add_role(self, ctx: commands.Context) -> None: """Adds the lovefest role.""" user = ctx.author - role = discord.utils.get(ctx.guild.roles, id=Lovefest.role_id) + role = ctx.guild.get_role(Lovefest.role_id) if Lovefest.role_id not in [role.id for role in ctx.message.author.roles]: await user.add_roles(role) await ctx.send("The Lovefest role has been added !") @@ -61,12 +62,12 @@ class BeMyValentine(commands.Cog): async def remove_role(self, ctx: commands.Context) -> None: """Removes the lovefest role.""" user = ctx.author - role = discord.utils.get(ctx.guild.roles, id=Lovefest.role_id) - if Lovefest.role_id not in [role.id for role in ctx.message.author.roles]: + role = ctx.guild.get_role(Lovefest.role_id) + if role not in ctx.author.roles: await ctx.send("You dont have the lovefest role.") else: await user.remove_roles(role) - await ctx.send("The lovefest role has been successfully removed !") + await ctx.send("The lovefest role has been successfully removed!") @commands.cooldown(1, 1800, BucketType.user) @commands.group(name='bemyvalentine', invoke_without_command=True) @@ -196,6 +197,6 @@ class BeMyValentine(commands.Cog): return valentine_compliment -def setup(bot: commands.Bot) -> None: +def setup(bot: Bot) -> None: """Be my Valentine Cog load.""" bot.add_cog(BeMyValentine(bot)) diff --git a/bot/exts/valentines/lovecalculator.py b/bot/exts/valentines/lovecalculator.py index 966acc82..c2a5da26 100644 --- a/bot/exts/valentines/lovecalculator.py +++ b/bot/exts/valentines/lovecalculator.py @@ -11,6 +11,8 @@ from discord import Member from discord.ext import commands from discord.ext.commands import BadArgument, Cog, clean_content +from bot.bot import Bot + log = logging.getLogger(__name__) with Path("bot/resources/valentines/love_matches.json").open(encoding="utf8") as file: @@ -21,9 +23,6 @@ with Path("bot/resources/valentines/love_matches.json").open(encoding="utf8") as class LoveCalculator(Cog): """A cog for calculating the love between two people.""" - def __init__(self, bot: commands.Bot): - self.bot = bot - @commands.command(aliases=('love_calculator', 'love_calc')) @commands.cooldown(rate=1, per=5, type=commands.BucketType.user) async def love(self, ctx: commands.Context, who: Union[Member, str], whom: Union[Member, str] = None) -> None: @@ -93,6 +92,6 @@ class LoveCalculator(Cog): await ctx.send(embed=embed) -def setup(bot: commands.Bot) -> None: +def setup(bot: Bot) -> None: """Love calculator Cog load.""" - bot.add_cog(LoveCalculator(bot)) + bot.add_cog(LoveCalculator()) diff --git a/bot/exts/valentines/movie_generator.py b/bot/exts/valentines/movie_generator.py index 4df9e0d5..461255ff 100644 --- a/bot/exts/valentines/movie_generator.py +++ b/bot/exts/valentines/movie_generator.py @@ -6,6 +6,8 @@ from urllib import parse import discord from discord.ext import commands +from bot.bot import Bot + TMDB_API_KEY = environ.get("TMDB_API_KEY") log = logging.getLogger(__name__) @@ -59,6 +61,6 @@ class RomanceMovieFinder(commands.Cog): await ctx.send(embed=embed) -def setup(bot: commands.Bot) -> None: +def setup(bot: Bot) -> None: """Romance movie Cog load.""" bot.add_cog(RomanceMovieFinder(bot)) diff --git a/bot/exts/valentines/myvalenstate.py b/bot/exts/valentines/myvalenstate.py index 041af7af..19e6b57f 100644 --- a/bot/exts/valentines/myvalenstate.py +++ b/bot/exts/valentines/myvalenstate.py @@ -7,6 +7,7 @@ from random import choice import discord from discord.ext import commands +from bot.bot import Bot from bot.constants import Colours log = logging.getLogger(__name__) @@ -46,7 +47,7 @@ class MyValenstate(commands.Cog): """Find the vacation spot(s) with the most matching characters to the invoking user.""" eq_chars = collections.defaultdict(int) if name is None: - author = ctx.message.author.name.lower().replace(' ', '') + author = ctx.author.name.lower().replace(' ', '') else: author = name.lower().replace(' ', '') @@ -60,7 +61,7 @@ class MyValenstate(commands.Cog): embed_title = "But there are more!" if len(matches) > 1: - leftovers = f"{', '.join(matches[:len(matches)-2])}, and {matches[len(matches)-1]}" + leftovers = f"{', '.join(matches[:-2])}, and {matches[-1]}" embed_text = f"You have {len(matches)} more matches, these being {leftovers}." elif len(matches) == 1: embed_title = "But there's another one!" @@ -81,6 +82,6 @@ class MyValenstate(commands.Cog): await ctx.send(embed=embed) -def setup(bot: commands.Bot) -> None: +def setup(bot: Bot) -> None: """Valenstate Cog load.""" bot.add_cog(MyValenstate(bot)) diff --git a/bot/exts/valentines/pickuplines.py b/bot/exts/valentines/pickuplines.py index 74c7e68b..bb322016 100644 --- a/bot/exts/valentines/pickuplines.py +++ b/bot/exts/valentines/pickuplines.py @@ -6,6 +6,7 @@ from pathlib import Path import discord from discord.ext import commands +from bot.bot import Bot from bot.constants import Colours log = logging.getLogger(__name__) @@ -17,9 +18,6 @@ with open(Path("bot/resources/valentines/pickup_lines.json"), "r", encoding="utf class PickupLine(commands.Cog): """A cog that gives random cheesy pickup lines.""" - def __init__(self, bot: commands.Bot): - self.bot = bot - @commands.command() async def pickupline(self, ctx: commands.Context) -> None: """ @@ -39,6 +37,6 @@ class PickupLine(commands.Cog): await ctx.send(embed=embed) -def setup(bot: commands.Bot) -> None: +def setup(bot: Bot) -> None: """Pickup lines Cog load.""" - bot.add_cog(PickupLine(bot)) + bot.add_cog(PickupLine()) diff --git a/bot/exts/valentines/savethedate.py b/bot/exts/valentines/savethedate.py index ac38d279..bda5d8c6 100644 --- a/bot/exts/valentines/savethedate.py +++ b/bot/exts/valentines/savethedate.py @@ -6,6 +6,7 @@ from pathlib import Path import discord from discord.ext import commands +from bot.bot import Bot from bot.constants import Colours log = logging.getLogger(__name__) @@ -19,9 +20,6 @@ with open(Path("bot/resources/valentines/date_ideas.json"), "r", encoding="utf8" class SaveTheDate(commands.Cog): """A cog that gives random suggestion for a Valentine's date.""" - def __init__(self, bot: commands.Bot): - self.bot = bot - @commands.command() async def savethedate(self, ctx: commands.Context) -> None: """Gives you ideas for what to do on a date with your valentine.""" @@ -36,6 +34,6 @@ class SaveTheDate(commands.Cog): await ctx.send(embed=embed) -def setup(bot: commands.Bot) -> None: +def setup(bot: Bot) -> None: """Save the date Cog Load.""" - bot.add_cog(SaveTheDate(bot)) + bot.add_cog(SaveTheDate()) diff --git a/bot/exts/valentines/valentine_zodiac.py b/bot/exts/valentines/valentine_zodiac.py index 2696999f..237fe5db 100644 --- a/bot/exts/valentines/valentine_zodiac.py +++ b/bot/exts/valentines/valentine_zodiac.py @@ -9,6 +9,7 @@ from typing import Tuple, Union import discord from discord.ext import commands +from bot.bot import Bot from bot.constants import Colours log = logging.getLogger(__name__) @@ -20,8 +21,7 @@ HEART_EMOJIS = [":heart:", ":gift_heart:", ":revolving_hearts:", ":sparkling_hea class ValentineZodiac(commands.Cog): """A Cog that returns a counter compatible zodiac sign to the given user's zodiac sign.""" - def __init__(self, bot: commands.Bot): - self.bot = bot + def __init__(self): self.zodiacs, self.zodiac_fact = self.load_comp_json() @staticmethod @@ -141,6 +141,6 @@ class ValentineZodiac(commands.Cog): log.trace("Embed from date successfully sent.") -def setup(bot: commands.Bot) -> None: +def setup(bot: Bot) -> None: """Valentine zodiac Cog load.""" - bot.add_cog(ValentineZodiac(bot)) + bot.add_cog(ValentineZodiac()) diff --git a/bot/exts/valentines/whoisvalentine.py b/bot/exts/valentines/whoisvalentine.py index ab6b1ca1..73cdcf52 100644 --- a/bot/exts/valentines/whoisvalentine.py +++ b/bot/exts/valentines/whoisvalentine.py @@ -6,6 +6,7 @@ from random import choice import discord from discord.ext import commands +from bot.bot import Bot from bot.constants import Colours log = logging.getLogger(__name__) @@ -17,9 +18,6 @@ with open(Path("bot/resources/valentines/valentine_facts.json"), "r", encoding=" class ValentineFacts(commands.Cog): """A Cog for displaying facts about Saint Valentine.""" - def __init__(self, bot: commands.Bot): - self.bot = bot - @commands.command(aliases=('whoisvalentine', 'saint_valentine')) async def who_is_valentine(self, ctx: commands.Context) -> None: """Displays info about Saint Valentine.""" @@ -47,6 +45,6 @@ class ValentineFacts(commands.Cog): await ctx.send(embed=embed) -def setup(bot: commands.Bot) -> None: +def setup(bot: Bot) -> None: """Who is Valentine Cog load.""" - bot.add_cog(ValentineFacts(bot)) + bot.add_cog(ValentineFacts()) |