Esempio n. 1
0
 async def generate_send_embed(self,
                               title,
                               fields,
                               channel,
                               colour=None,
                               timestamp=datetime.utcnow(),
                               thumbnail_url=None):
     """
     generate an embed using some defaults\n
     :param title: str, the title of the embed
     :param fields: list[tuple[str, str, bool]], all
         the fields to add to the embed ordered like this:
         (title, text, inline?)
     :param channel: str, int, or TextChannel, the channel to send the embed to
     :param colour: optional color, the color of the embed
     :param timestamp: optional str, the timestamp
     :param thumbnail_url: optional str, the image to put in the thumbnail
     :return: Embed, the generated embed
     """
     embed = self.generate_embed(title, fields, colour, timestamp,
                                 thumbnail_url)
     if type(channel) == str:
         channel = self.get_channel(Data.get_channel(channel))
     elif type(channel) == int:
         channel = self.get_channel(channel)
     await channel.send(embed=embed)
     return
Esempio n. 2
0
 async def send_bug_report(self, exc, **kwargs):  # sourcery skip
     """
     send a bug report to a channel\n
     :param exc: str, the reported exception
     :param kwargs: any arguments
     """
     # sourcery will be skipped bc this function will grow with more exceptions
     out = self.get_channel(Data.get_channel("bot bugs"))
     if exc == "MemberNotFound":
         msg = f"MemberNotFound: could not find member '{kwargs['name']}' " \
               f"in guild '{kwargs['guild']}'. Command was invoked by user {kwargs['author']}"
     elif exc == "KeyError":
         msg = f"KeyError: member {kwargs['name']} (id {kwargs['key']}) does not exist in {kwargs['data']}"
     else:
         raise ExceptionNotFound(exc)
     await out.send(msg)
     return