-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Labels
Extension: ProtectNew moduleIssues relating to building a new moduleIssues relating to building a new module
Description
Improve upon this code, and make the timeout a configurable list of strings instead of a hardcoded item
import munch
from core import auxiliary, cogs
from discord.ext import commands
from datetime import timedelta
async def setup(bot):
await bot.add_cog(AutoMute(bot=bot, extension_name="automute"))
class AutoMute(cogs.MatchCog):
"""Class for the autoreact to make it to discord."""
async def match(
self, config: munch.Munch, _: commands.Context, content: str
) -> bool:
"""A match function to determine if somehting should be reacted to
Args:
config (munch.Munch): The guild config for the running bot
content (str): The string content of the message
Returns:
bool: True if there needs to be a reaction, False otherwise
"""
if content.startswith("?8350"):
return True
async def response(
self, config: munch.Munch, ctx: commands.Context, content: str, _: bool
):
"""The function to generate and add reactions
Args:
config (munch.Munch): The guild config for the running bot
ctx (commands.Context): The context in which the message was sent in
content (str): The string content of the message
"""
await ctx.author.timeout(timedelta(seconds=60))Metadata
Metadata
Assignees
Labels
Extension: ProtectNew moduleIssues relating to building a new moduleIssues relating to building a new module