diff options
author | 2023-05-01 14:47:55 +0100 | |
---|---|---|
committer | 2023-05-06 13:20:47 +0100 | |
commit | f57fbfb7dea0990b0ac6fddfa9b04c862801c29b (patch) | |
tree | bcbaa18ecd483c372605d5d7b08dd7d00f60e164 /bot | |
parent | revert renaming of Client to Bot (diff) |
move lovefest role under the Roles class
Diffstat (limited to 'bot')
-rw-r--r-- | bot/constants.py | 13 | ||||
-rw-r--r-- | bot/exts/holidays/valentines/be_my_valentine.py | 6 | ||||
-rw-r--r-- | bot/exts/holidays/valentines/lovecalculator.py | 6 |
3 files changed, 8 insertions, 17 deletions
diff --git a/bot/constants.py b/bot/constants.py index 4a977b79..5f70c8b9 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -14,7 +14,6 @@ __all__ = ( "Colours", "Emojis", "Icons", - "Lovefest", "Month", "Roles", "Tokens", @@ -243,16 +242,6 @@ class Icons: ) -class _Lovefest(EnvConfig): - - EnvConfig.Config.env_prefix = "lovefest_" - - role_id = 542431903886606399 - - -Lovefest = _Lovefest() - - class Month(enum.IntEnum): JANUARY = 1 FEBRUARY = 2 @@ -288,6 +277,8 @@ class _Roles(EnvConfig): core_developers = 587606783669829632 everyone = Client.guild + lovefest = 542431903886606399 + Roles = _Roles() diff --git a/bot/exts/holidays/valentines/be_my_valentine.py b/bot/exts/holidays/valentines/be_my_valentine.py index 5ffd14e6..3a2beef3 100644 --- a/bot/exts/holidays/valentines/be_my_valentine.py +++ b/bot/exts/holidays/valentines/be_my_valentine.py @@ -7,7 +7,7 @@ import discord from discord.ext import commands from bot.bot import Bot -from bot.constants import Channels, Colours, Lovefest, Month, PYTHON_PREFIX +from bot.constants import Channels, Colours, Month, PYTHON_PREFIX, Roles from bot.utils.decorators import in_month from bot.utils.exceptions import MovedCommandError @@ -60,7 +60,7 @@ class BeMyValentine(commands.Cog): # This command should only be used in the server raise commands.UserInputError("You are supposed to use this command in the server.") - if Lovefest.role_id not in [role.id for role in user.roles]: + if Roles.lovefest not in [role.id for role in user.roles]: raise commands.UserInputError( f"You cannot send a valentine to {user} as they do not have the lovefest role!" ) @@ -95,7 +95,7 @@ class BeMyValentine(commands.Cog): example : .bemyvalentine secret Iceman#6508 Hey I love you, wanna hang around ? (sends the custom message to Iceman in DM making you anonymous) """ - if Lovefest.role_id not in [role.id for role in user.roles]: + if Roles.lovefest not in [role.id for role in user.roles]: await ctx.message.delete() raise commands.UserInputError( f"You cannot send a valentine to {user} as they do not have the lovefest role!" diff --git a/bot/exts/holidays/valentines/lovecalculator.py b/bot/exts/holidays/valentines/lovecalculator.py index c212e833..eab3d083 100644 --- a/bot/exts/holidays/valentines/lovecalculator.py +++ b/bot/exts/holidays/valentines/lovecalculator.py @@ -12,7 +12,7 @@ from discord.ext import commands from discord.ext.commands import BadArgument, Cog, clean_content from bot.bot import Bot -from bot.constants import Channels, Lovefest, Month, PYTHON_PREFIX +from bot.constants import Channels, Month, PYTHON_PREFIX, Roles from bot.utils.decorators import in_month log = logging.getLogger(__name__) @@ -45,8 +45,8 @@ class LoveCalculator(Cog): Running .love @chrisjl#2655 @joe#6000 will yield the same result as before. """ if ( - Lovefest.role_id not in [role.id for role in who.roles] - or (whom is not None and Lovefest.role_id not in [role.id for role in whom.roles]) + Roles.lovefest not in [role.id for role in who.roles] + or (whom is not None and Roles.lovefest not in [role.id for role in whom.roles]) ): raise BadArgument( "This command can only be ran against members with the lovefest role! " |