예제 #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))
예제 #2
0
 async def story(self, ctx, *, name):
     quest = FindBest(ToEmbed.DIRS['Quests'], name, ['iname', 'name'], True)
     (embed, limit) = ToEmbed.Quest(quest, 'story')
     if not limit:
         msg = await ctx.send(embed=embed)
         #await self.add_reactions(msg,PAGES['quest'])
     else:
         for e in embed:
             await ctx.send(embed=e)
예제 #3
0
    async def map(self, ctx, *, name):
        quest = FindBest(ToEmbed.DIRS['Quests'], name, ['name', 'iname'], True)
        (embed, image) = ToEmbed.Quest(quest, 'map')

        if image:
            msg = await ctx.send(embed=embed,
                                 file=discord.File(
                                     image, filename='{}.png'.format(quest)))
        else:
            msg = await ctx.send(embed=embed)
        await self.add_reactions(msg, PAGES['quest'])
예제 #4
0
 async def ai(self, ctx, *, name):
     ai = FindBest(ToEmbed.DIRS['Ai'], name, ['iname'], True)
     msg = await ctx.send(embed=ToEmbed.AI(ai, 'main'))
예제 #5
0
 async def gear(self, ctx, *, name):
     gear = FindBest(ToEmbed.DIRS['Artifact'], name, ['keywords'], True)
     msg = await ctx.send(embed=ToEmbed.Gear(gear, 'main'))
     await self.add_reactions(msg, PAGES['gear'])
예제 #6
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'])
예제 #7
0
 async def art(self, ctx, *, name):
     unit = FindBest(ToEmbed.DIRS['Unit'], name,
                     ['name', 'nameJP', 'keywords'], True)
     for embed in ToEmbed.Unit(unit, 'art'):
         await ctx.send(embed=embed)
예제 #8
0
 async def kaigan(self, ctx, *, name):
     unit = FindBest(ToEmbed.DIRS['Unit'], name,
                     ['name', 'nameJP', 'keywords'], True)
     msg = await ctx.send(embed=ToEmbed.Unit(unit, 'kaigan'))
     await self.add_reactions(msg, PAGES['unit'])
예제 #9
0
 async def nensou(self, ctx, *, name):
     card = FindBest(ToEmbed.DIRS['Conceptcard'], name,
                     ['keywords', 'iname'], True)
     msg = await ctx.send(embed=ToEmbed.Conceptcard(card, 'main'))
     await self.add_reactions(msg, PAGES['conceptcard'])
예제 #10
0
 async def farm(self, ctx, *, name):
     item = FindBest(ToEmbed.DIRS['Item'], name, ['name'], True)
     msg = await ctx.send(embed=ToEmbed.Item(item, 'Story'))
     await self.add_reactions(msg, PAGES['item'])