mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-10 15:57:53 +00:00
Catch exceptions in message handler and not command dispatch. Closes #18
This commit is contained in:
parent
22b206c562
commit
fd67945660
3 changed files with 43 additions and 32 deletions
|
|
@ -3,14 +3,14 @@ from typing import Tuple
|
|||
import discord
|
||||
|
||||
|
||||
def success(text: str):
|
||||
def success(text: str) -> discord.Embed:
|
||||
embed = discord.Embed()
|
||||
embed.description = text
|
||||
embed.colour = discord.Colour.green()
|
||||
return embed
|
||||
|
||||
|
||||
def error(text: str, help: Tuple[str, str] = None):
|
||||
def error(text: str, help: Tuple[str, str] = None) -> discord.Embed:
|
||||
embed = discord.Embed()
|
||||
embed.description = text
|
||||
embed.colour = discord.Colour.dark_red()
|
||||
|
|
@ -22,8 +22,20 @@ def error(text: str, help: Tuple[str, str] = None):
|
|||
return embed
|
||||
|
||||
|
||||
def status(text: str):
|
||||
def status(text: str) -> discord.Embed:
|
||||
embed = discord.Embed()
|
||||
embed.description = text
|
||||
embed.colour = discord.Colour.blue()
|
||||
return embed
|
||||
|
||||
def exception_log(message_content, author_name, author_discriminator, server_id, channel_id) -> discord.Embed:
|
||||
embed = discord.Embed()
|
||||
embed.colour = discord.Colour.dark_red()
|
||||
embed.title = message_content
|
||||
|
||||
embed.set_footer(text="Sender: {}#{} | Server: {} | Channel: {}".format(
|
||||
author_name, author_discriminator,
|
||||
server_id if server_id else "(DMs)",
|
||||
channel_id
|
||||
))
|
||||
return embed
|
||||
Loading…
Add table
Add a link
Reference in a new issue