generated from HoloTech/twitch-bot-template
(yarn): Add yarn module for one-off commands
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
async def twitch_setup(bot):
|
||||
from .component import YarnComponent
|
||||
await bot.add_component(YarnComponent(bot))
|
||||
@@ -0,0 +1,20 @@
|
||||
import asyncio
|
||||
|
||||
import twitchio
|
||||
from twitchio import PartialUser, Scopes, eventsub
|
||||
from twitchio.ext import commands as cmds
|
||||
|
||||
from meta import Bot, Context
|
||||
|
||||
from . import logger
|
||||
|
||||
class YarnComponent(cmds.Component):
|
||||
def __init__(self, bot: Bot):
|
||||
self.bot = bot
|
||||
|
||||
|
||||
@cmds.Component.listener()
|
||||
async def event_custom_redemption_add(self, payload: twitchio.ChannelPointsRedemptionAdd):
|
||||
logger.info(f"Yarn got {payload!r}")
|
||||
if payload.reward.title == 'pet lilac':
|
||||
await payload.broadcaster.send_message("lilac PETPET", sender="1097964183")
|
||||
Reference in New Issue
Block a user