コード例 #1
0
ファイル: fun.py プロジェクト: z03h/CyberTron5000-1
 async def words(self, ctx, *words):
     """Get information on many words"""
     async with ctx.typing():
         _dict = dictionary(*words)
         try:
             ret = await self.bot.loop.run_in_executor(
                 None, _dict.getMeanings)
         except Exception as error:
             raise error
         embed = discord.Embed(colour=self.bot.colour)
         embed.title = "Words"
         not_found = list()
         for word in words:
             meanings = ret.get(word)
             if not meanings:
                 not_found.append(word)
                 continue
             embed.add_field(name=word.lower(),
                             value=self.format_meanings(meanings))
     if not_found:
         embed.set_footer(text=', '.join(not_found) + " were not found.")
     try:
         await ctx.send(embed=embed)
     except discord.HTTPException:
         return await ctx.send("You passed in too many words!")
コード例 #2
0
ファイル: fun.py プロジェクト: z03h/CyberTron5000-1
 def __init__(self, bot):
     self.bot = bot
     self.sr = Client()
     self._dictionary = dictionary()