示例#1
0
 def on_message(self, ws, data):
     ind = json.loads(data)
     if 'data' in ind:
         if 'topic' in ind['data']:
             if ind['data']['topic'] == modtopic:
                 actdict = json.loads(ind['data']['message'])
                 pluginmanager.runEvent(
                     "TWITCH:MOD:%s" %
                     actdict['data']['moderation_action'].upper(),
                     twitchchannel=cfg['Channel'],
                     **actdict['data'])
                 pluginmanager.runEvent("TWITCH:MOD",
                                        twitchchannel=cfg['Channel'],
                                        **actdict['data'])
示例#2
0
 def proc(self, message):
     if message.content.startswith('?') and message.author is not pluginmanager.resources["DSC"]['BOT'].user:
         parts = message.content.split(' ')
         args = parts[1:]
         command = parts[0]
         pargs=None
         help, parse = self.getHelp(command)
         if parse:
             try:
                 pargs = vars(help.parse_args(args))
             except:
                 bot = pluginmanager.resources["DSC"]["BOT"]
                 loop = pluginmanager.resources["DSC"]["LOOP"]
                 asyncio.run_coroutine_threadsafe(bot.send_message(message.channel, "Error parsing command. Please see `?help %s`"%command), loop)
                 return True
         pluginmanager.runEvent('DSC:COMMAND:%s'%command.upper(), args=args, message=message, pargs=pargs, command=command.lower())
         return True
示例#3
0
 async def on_message_edit(self, before, after):
     if before.pinned and not after.pinned:
         pluginmanager.runEvent("DSC:UNPIN", after)
     elif after.pinned and not before.pinned:
         pluginmanager.runEvent("DSC:PIN", after)
示例#4
0
 async def on_message(self, message):
     pluginmanager.runEvent("DSC:MSG", message)
示例#5
0
 async def on_ready(self):
     print('Logged into discord as: %s (%s)' %
           (self.bot.user.name, self.bot.user.id))
     pluginmanager.runEvent("DSC:READY")
示例#6
0
 async def rnotice(self, event=None, tags=None, **kw):
     kw['notice'] = event
     if tags:
         kw['tags'] = irc3.tags.decode(tags)
     pluginmanager.runEvent("TWITCH:NOTICE", **kw)
示例#7
0
 async def prvmsg(self, event=None, mask=None, tags=None, **kw):
     if tags:
         kw['tags'] = irc3.tags.decode(tags)
     kw['nick'] = mask.nick
     pluginmanager.runEvent("TWITCH:MSG", **kw)
示例#8
0
 async def connected(self, **kw):
     await self.bot.send_line("CAP REQ :twitch.tv/tags")
     await self.bot.send_line("CAP REQ :twitch.tv/membership")
     await self.bot.send_line("CAP REQ :twitch.tv/commands")
     self.bot.join(cfg['Channel'])
     pluginmanager.runEvent("TWITCH:CONNECTED")