oopsie fix url stuff
This commit is contained in:
6
bot.py
6
bot.py
@@ -22,11 +22,11 @@ async def on_message(message):
|
||||
if message.author == bot.user:
|
||||
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, not in a URL)
|
||||
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), but exclude URLs
|
||||
new_content = re.sub(
|
||||
r'\b(nixos)\b',
|
||||
r'(?<!https?://\S*)\b(nixos)\b(?!\S*\/)',
|
||||
lambda m: 'FagOS' if m.group(1)[0].isupper() else 'fagOS',
|
||||
message.content,
|
||||
flags=re.IGNORECASE
|
||||
|
||||
Reference in New Issue
Block a user