From 4224ff4d554c12b318010f994cafb27ba46b38c0 Mon Sep 17 00:00:00 2001 From: andrewj-brown <92134285+andrewj-brown@users.noreply.github.com> Date: Wed, 8 Nov 2023 17:21:37 +1000 Subject: [PATCH] style. also take 2 --- uqcsbot/yelling.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/uqcsbot/yelling.py b/uqcsbot/yelling.py index 3af7d5f..8aa28fa 100644 --- a/uqcsbot/yelling.py +++ b/uqcsbot/yelling.py @@ -1,5 +1,5 @@ import discord -from typing import List, Dict, Callable, Any, Generic +from typing import List, Dict, Callable, Any from discord.ext import commands from discord._types import ClientT from random import choice, random @@ -12,9 +12,11 @@ from datetime import timedelta from functools import wraps -class DodgyType(discord.interactions.Interaction[ClientT]): + +class DodgyType(discord.interactions.InteractionResponse[ClientT]): pass + def yelling_exemptor(input_args: List[str] = ["text"]) -> Callable[..., Any]: def handler(func: Callable[..., Any]): @wraps(func) @@ -28,7 +30,7 @@ async def wrapper( await func(cogself, *args, **kwargs) return for a in args: - if isinstance(a, DodgyType): + if isinstance(a, discord.interactions.Interaction): interaction = a break if interaction is None: @@ -49,7 +51,9 @@ async def wrapper( if not Yelling.contains_lowercase(text): await func(cogself, *args, **kwargs) return - await interaction.response.send_message( + + assert isinstance((x := interaction.response), DodgyType) + await x.send_message( str(discord.utils.get(bot.emojis, name="disapproval") or "") ) if isinstance(interaction.user, discord.Member):