mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 09:16:19 +00:00
refactor(makeprompt.py): simplify need_ignore_message function and remove unnecessary return statement
fix(makeprompt.py): fix bug where messages in premium channels were being ignored
This commit is contained in:
@@ -97,7 +97,7 @@ async def need_ignore_message(bot, data_dict, message, guild_data, original_mess
|
|||||||
## ---- Message ignore conditions ---- ##
|
## ---- Message ignore conditions ---- ##
|
||||||
if data_dict["api_key"] is None:
|
if data_dict["api_key"] is None:
|
||||||
return True # if the api key is not set, return
|
return True # if the api key is not set, return
|
||||||
|
ret = False
|
||||||
if (
|
if (
|
||||||
# if the message is not in a premium channel and
|
# if the message is not in a premium channel and
|
||||||
not (str(message.channel.id) in [str(channel) for channel in channels]
|
not (str(message.channel.id) in [str(channel) for channel in channels]
|
||||||
@@ -107,7 +107,12 @@ async def need_ignore_message(bot, data_dict, message, guild_data, original_mess
|
|||||||
# if the message is not in the default channel
|
# if the message is not in the default channel
|
||||||
and str(message.channel.id) != str(data_dict["channel_id"])
|
and str(message.channel.id) != str(data_dict["channel_id"])
|
||||||
):
|
):
|
||||||
|
ret = True
|
||||||
|
for channel in channels:
|
||||||
|
if str(message.channel.id) == str(channel):
|
||||||
|
ret = False
|
||||||
print("Message ignored in guild " + str(message.guild.id))
|
print("Message ignored in guild " + str(message.guild.id))
|
||||||
|
if ret:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# if the bot has been used more than max_uses*5 times in the last 24 hours in this guild and the guild is premium
|
# if the bot has been used more than max_uses*5 times in the last 24 hours in this guild and the guild is premium
|
||||||
|
|||||||
Reference in New Issue
Block a user