2727from typing import Any
2828
2929import discord
30+ from redbot .core import Config
3031from red_commons .logging import getLogger
3132
3233logger = getLogger ("red.maxcogs.counting.utils" )
@@ -92,10 +93,10 @@ async def handle_invalid_count(
9293
9394
9495async def assign_ruin_role (
95- bot : discord . Client ,
96+ config : Config ,
9697 member : discord .Member ,
9798 guild : discord .Guild ,
98- settings : dict [str , any ]
99+ settings : dict [str , Any ]
99100) -> None :
100101 """Assign the ruin role to a member, temporarily if a duration is set."""
101102 ruin_role_id = settings ["ruin_role_id" ]
@@ -121,15 +122,14 @@ async def assign_ruin_role(
121122 await member .add_roles (role , reason = "Ruined the count" )
122123 if duration :
123124 expiry = datetime .now (timezone .utc ) + timedelta (seconds = duration )
124- async with bot . config .guild (guild ).temp_roles () as temp_roles :
125+ async with config .guild (guild ).temp_roles () as temp_roles :
125126 temp_roles [str (member .id )] = {
126127 "role_id" : role .id ,
127128 "expiry" : expiry .timestamp (),
128129 }
129130 except discord .Forbidden :
130131 logger .warning (f"Missing permissions to assign role { role .name } in { guild .name } " )
131132
132-
133133async def remove_expired_roles (bot : discord .Client , guild : discord .Guild ) -> None :
134134 """Remove expired temporary roles from users in a guild."""
135135 async with bot .config .guild (guild ).temp_roles () as temp_roles :
0 commit comments