2024-04-05 12:05:36 +00:00
|
|
|
import random
|
|
|
|
|
|
|
|
from discord.ext.commands import Cog
|
|
|
|
|
2024-04-05 12:06:44 +00:00
|
|
|
from config.parser import JsonCache
|
|
|
|
|
2024-04-05 12:05:36 +00:00
|
|
|
_reactions = JsonCache.read_json("reactions")
|
|
|
|
_8ball = _reactions["eightball"]
|
|
|
|
_full = _reactions["full_content_reactions"]
|
|
|
|
|
|
|
|
|
|
|
|
class ReactionHandler:
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
async def respond(message):
|
|
|
|
content = message.content.lower()
|
|
|
|
|
2024-06-15 22:45:24 +00:00
|
|
|
if (content.startswith("lumi ") or content.startswith("lumi, ")) and content.endswith("?"):
|
2024-04-05 12:05:36 +00:00
|
|
|
response = random.choice(_8ball)
|
|
|
|
await message.reply(content=response)
|
|
|
|
|
|
|
|
for trigger, response in _full.items():
|
|
|
|
if trigger.lower() == content:
|
|
|
|
await message.reply(response)
|
|
|
|
|
|
|
|
|
|
|
|
class ReactionListener(Cog):
|
|
|
|
def __init__(self, client):
|
|
|
|
self.client = client
|
|
|
|
|
|
|
|
@Cog.listener('on_message')
|
|
|
|
async def reaction_listener(self, message):
|
|
|
|
if not message.author.bot:
|
|
|
|
await ReactionHandler.respond(message)
|
|
|
|
|
|
|
|
|
|
|
|
def setup(client):
|
|
|
|
client.add_cog(ReactionListener(client))
|