NOtice the capital OS
This commit is contained in:
8
bot.py
8
bot.py
@@ -21,19 +21,21 @@ async def on_message(message):
|
|||||||
# Ignore messages sent by the bot itself to prevent loops
|
# Ignore messages sent by the bot itself to prevent loops
|
||||||
if message.author == bot.user:
|
if message.author == bot.user:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Check if the message contains "nixos" (case-insensitive, as a whole word)
|
# Check if the message contains "nixos" (case-insensitive, as a whole word)
|
||||||
if re.search(r'\bnixos\b', message.content, re.IGNORECASE):
|
if re.search(r'\bnixos\b', message.content, re.IGNORECASE):
|
||||||
# Replace "nixos" with "fagos" (preserving case of the first letter)
|
# Replace "nixos" with "fagOS" (preserving case of the first letter)
|
||||||
new_content = re.sub(
|
new_content = re.sub(
|
||||||
r'\b(nixos)\b',
|
r'\b(nixos)\b',
|
||||||
lambda m: 'Fagos' if m.group(1)[0].isupper() else 'fagos',
|
lambda m: 'FagOS' if m.group(1)[0].isupper() else 'fagOS',
|
||||||
message.content,
|
message.content,
|
||||||
flags=re.IGNORECASE
|
flags=re.IGNORECASE
|
||||||
)
|
)
|
||||||
# Send the modified message
|
# Send the modified message
|
||||||
await message.channel.send(f'{new_content}')
|
await message.channel.send(f'{new_content}')
|
||||||
|
|
||||||
# Allow other commands to process (if any)
|
# Allow other commands to process (if any)
|
||||||
await bot.process_commands(message)
|
await bot.process_commands(message)
|
||||||
|
|
||||||
# Run the bot using the token from the environment variable
|
# Run the bot using the token from the environment variable
|
||||||
bot.run(os.getenv('FAGOS_TOKEN'))
|
bot.run(os.getenv('FAGOS_TOKEN'))
|
||||||
Reference in New Issue
Block a user