Exemple #1
0
    async def on_raw_reaction_add(self, payload):
        #message_id #int – The message ID that got or lost a reaction.
        #user_id #int – The user ID who added or removed the reaction.
        #channel_id #int – The channel ID where the reaction got added or removed.
        #guild_id #Optional[int] – The guild ID where the reaction got added or removed, if applicable.
        #emoji #PartialEmoji – The custom or unicode emoji being used.
        try:
            msg = await self.bot.get_channel(payload.channel_id
                                             ).get_message(payload.message_id)
        except:
            print('Failed to handle {payload},{msg}\nJump-Url:{URL}'.format(
                payload=payload,
                msg=payload.message_id,
                URL=
                'https://discordapp.com/channels/{server}/{channel}/{message}'.
                format(server=payload.guild,
                       channel=payload.channel_id,
                       message=payload.message_id)))
            return 0

        if payload.user_id != self.bot.user.id and msg.author == self.bot.user:
            emoji = payload.emoji.name
            ftext = msg.embeds[0].footer.text
            etitle = msg.embeds[0].author.name

            if ftext == 'Emoji-Converter':
                embed2 = discord.Embed(title="Reaction",
                                       description='```' + emoji + '```',
                                       color=0x00FF00)
                embed2.set_footer(text='Emoji-Converter')
                await msg.edit(embed=embed2)

            elif ftext == 'Unit':
                unit = FindBest(ToEmbed.DIRS['Unit'], etitle)
                await msg.edit(embed=ToEmbed.Unit(unit, PAGES['unit'][emoji]))
            elif ftext[:3] == 'Job':
                job = ftext[4:]
                await msg.edit(embed=ToEmbed.Job(job, PAGES['job'][emoji]))
            elif ftext == 'Item':
                item = FindBest(ToEmbed.DIRS['Item'], etitle)
                await msg.edit(embed=ToEmbed.Item(item, PAGES['item'][emoji]))
            elif ftext[:5] == 'Quest':
                quest = ftext[8:]
                await msg.edit(
                    embed=ToEmbed.Quest(quest, PAGES['quest'][emoji], True))
Exemple #2
0
 async def job(self, ctx, *, name):
     job = FindBest(ToEmbed.DIRS['Job'], name, ['keywords'], True)
     msg = await ctx.send(embed=ToEmbed.Job(job, 'main'))
     await self.add_reactions(msg, PAGES['job'])