Beispiel #1
0
 def gen_participants_pages(self):
     info = ""
     point_count = dict()
     for rid, report in self.reported_cards.items():
         user = str(report["author_id"])
         if not user in point_count.keys():
             point_count[user] = 0
         if report["status"] == "Approved":
             point_count[user] += self.config.boards[report["board"]]["points"]
     for participant_id, name in self.participants.items():
         info += f"{name} (`{participant_id}`: {point_count[participant_id] if participant_id in point_count else 0})\n"
     return Pages.paginate(info)
def handle_exception(event, bot, exception):
    # catch everything and extract all info we can from the func arguments so we see what exactly was going on
    print("Exception caught, extracting information")

    print("====EXCEPTION====")
    print(exception)

    print("====STACKTRACE====")
    print(traceback.format_exc())

    print("====ORIGINAL MESSAGE====")
    print(event.msg.content)

    print("====SENDER====")
    print(event.msg.author)

    print("====Channel====")
    print("{} ({})".format(event.msg.channel.name, event.msg.channel.id))

    embed = MessageEmbed()
    embed.title = "Exception caught"
    embed.add_field(name="Original message",
                    value=Utils.trim_message(event.msg.content, 1024))
    embed.add_field(name="Channel",
                    value="{} ({})".format(event.msg.channel.name,
                                           event.msg.channel.id))
    embed.add_field(name="Sender", value=str(event.msg.author))
    embed.add_field(name="Exception", value=str(exception))
    parts = Pages.paginate(str(traceback.format_exc()), max_chars=1024)
    if len(parts) > 4:
        embed.add_field(
            name="Stacktrace",
            value=
            "Something went incredibly wrong, stacktrace is over 4096 chars!")
    else:
        for part in parts:
            embed.add_field(name="Stacktrace", value=part)
    embed.timestamp = datetime.utcnow().isoformat()
    embed.color = int('ff0000', 16)
    log_to_bot_log(bot, embed=embed)
Beispiel #3
0
 def gen_participants_pages(self):
     info = ""
     for participant_id, name in self.participants.items():
         info += "{} (`{}`)\n".format(name, participant_id)
     return Pages.paginate(info)