import discord from redbot.core import Config, commands, checks from redbot.core.utils.chat_formatting import pagify from typing import Literal class SmartReact(commands.Cog): """Create automatic reactions when trigger words are typed in chat""" default_guild_settings = {"reactions": {}} def __init__(self, bot): self.bot = bot self.conf = Config.get_conf(self, identifier=964952632) self.conf.register_guild(**self.default_guild_settings) @checks.mod_or_permissions(administrator=True) @commands.guild_only() @commands.command(name="addreact") async def addreact(self, ctx, word, emoji): """Add an auto reaction to a word""" guild = ctx.message.guild message = ctx.message emoji = self.fix_custom_emoji(emoji) await self.create_smart_reaction(guild, word, emoji, message) @checks.mod_or_permissions(administrator=True) @commands.guild_only() @commands.command(name="delreact") async def delreact(self, ctx, word, emoji): """Delete an auto reaction to a word""" guild = ctx.message.guild message = ctx.message emoji = self.fix_custom_emoji(emoji) await self.remove_smart_reaction(guild, word, emoji, message) def fix_custom_emoji(self, emoji): if emoji[:2] not in ["<:", "