Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/SuperAnt220/antbot into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperAnt220 committed Sep 9, 2024
2 parents b6a6877 + 79fbf86 commit 0ffd9b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cogs/ideas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
wrong_channel_errors = [
{
"contains": "AttributeError",
"msg": "Не тот канал"
"msg": "Это не ветка обсуждения идеи"
},
{
"contains": "Wrong channel",
"msg": "Не тот канал"
"msg": "Это не ветка обсуждения идеи"
}
]

Expand Down
5 changes: 4 additions & 1 deletion utils/general.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import discord
from discord.ext import commands

from settings import BOT_COMMANDS_CHANNEL_ID
from utils.msg_utils import Emojis
from utils.shortcuts import no_ping

async def handle_errors(ctx, error, errors):
if isinstance(ctx, discord.Interaction):
ctx = await commands.Context.from_interaction(ctx)
error_msg = str(error)
for case in errors:
case_cost = len(case) - 1
Expand All @@ -14,7 +17,7 @@ async def handle_errors(ctx, error, errors):
if "contains" in case and case["contains"] in error_msg:
curr_score += 1
#
if curr_score == case_cost:
if curr_score >= case_cost:
emoji = Emojis.exclamation_mark if not case['msg'].startswith("<") else ''
if ctx.interaction:
await ctx.interaction.response.send_message(f"{emoji}{case['msg']}", allowed_mentions=no_ping, ephemeral=True)
Expand Down

0 comments on commit 0ffd9b6

Please sign in to comment.