This commit is contained in:
2024-12-01 12:00:43 +01:00
parent 3d5d8a2c14
commit b6bbb50707
+8 -8
View File
@@ -218,18 +218,18 @@ class Events(commands.Cog):
await discord_friendly_send(channel, "Słyszałem ja żem że: " + message.content) await discord_friendly_send(channel, "Słyszałem ja żem że: " + message.content)
return return
channel = message.channel channel = message.channel
message.content = message.content.lower() message_content_lower = message.content.lower()
tdelta = datetime.now() - MASTER_TIMEOUT tdelta = datetime.now() - MASTER_TIMEOUT
tdelta = tdelta.total_seconds() tdelta = tdelta.total_seconds()
if "opowiedz o fabryczce" in message.content: if "opowiedz o fabryczce" in message_content_lower:
await message.reply(DATA["fabryczka"]) await message.reply(DATA["fabryczka"])
if "opowiedz mi o fabryczce" in message.content: if "opowiedz mi o fabryczce" in message_content_lower:
await message.reply(DATA["fabryczka"]) await message.reply(DATA["fabryczka"])
if tdelta > INITIAL_TIME_WAIT: if tdelta > INITIAL_TIME_WAIT:
for word in WORD_REACTIONS: for word in WORD_REACTIONS:
if re.search(r"\b" + word + r"\b", message.content): if re.search(r"\b" + word + r"\b", message_content_lower):
tdelta = datetime.now() - WORD_REACTIONS[word][2] tdelta = datetime.now() - WORD_REACTIONS[word][2]
tdelta = tdelta.total_seconds() tdelta = tdelta.total_seconds()
security_clearance = WORD_REACTIONS[word][4] security_clearance = WORD_REACTIONS[word][4]
@@ -252,11 +252,11 @@ class Events(commands.Cog):
if mention == self.bot.user: if mention == self.bot.user:
kondziu_mentioned = True kondziu_mentioned = True
if kondziu_mentioned or "conjurer:" in message.content: if kondziu_mentioned or "conjurer:" in message_content_lower:
async with channel.typing(): async with channel.typing():
self.logger.debug("Procedura chatu") self.logger.debug("Procedura chatu")
message.content = message.content.replace("conjurer: ", "") message_content_lower = message_content_lower.replace("conjurer: ", "")
if message.author.nick: if message.author.nick:
username = message.author.nick username = message.author.nick
else: else:
@@ -292,8 +292,8 @@ class Events(commands.Cog):
if "imaginuje sobie:" in message.content: if "imaginuje sobie:" in message.content:
async with channel.typing(): async with channel.typing():
self.logger.info("Poczatek procedury obrazkowej") self.logger.info("Poczatek procedury obrazkowej")
message.content = message.content.replace("imaginuje sobie: ", "") message_content_lower = message_content_lower.replace("imaginuje sobie: ", "")
self.logger.debug("Wywolanie obrazka: %s", message.content) self.logger.debug("Wywolanie obrazka: %s", message_content_lower)
try: try:
response = await OPENAICLIENT.images.generate( response = await OPENAICLIENT.images.generate(
model="dall-e-3", model="dall-e-3",