Added more error handling to the local error handler

pull/9/head
sgoudham 4 years ago
parent 69a48991da
commit 6e3309748b

@ -15,11 +15,12 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import datetime import datetime
import string
import asyncpg import asyncpg
from discord import Embed, TextChannel from discord import Embed, TextChannel
from discord.ext.commands import has_permissions, Cog, group, bot_has_permissions, BadArgument, MissingRequiredArgument, \ from discord.ext.commands import has_permissions, Cog, group, bot_has_permissions, BadArgument, MissingRequiredArgument, \
command command, MissingPermissions
from cogs.libs.modmail import Modmail from cogs.libs.modmail import Modmail
from cogs.libs.starboard import Starboard from cogs.libs.starboard import Starboard
@ -531,6 +532,11 @@ class Guild(Cog):
text = "Required Argument(s) Missing!" \ text = "Required Argument(s) Missing!" \
f"\nUse **{ctx.prefix}help** to find how to use **{ctx.command}**" f"\nUse **{ctx.prefix}help** to find how to use **{ctx.command}**"
await self.bot.generate_embed(ctx, desc=text) await self.bot.generate_embed(ctx, desc=text)
elif isinstance(exc, MissingPermissions):
missing_perms = string.capwords(", ".join(exc.missing_perms).replace("_", " "))
text = f"{self.bot.cross} Uh oh! You Need **{missing_perms}** Permission(s) To Execute This Command! {self.bot.cross}"
await self.bot.generate_embed(ctx, desc=text)
def setup(bot): def setup(bot):

Loading…
Cancel
Save