nova-cord/cord/autochat.py

55 lines
1.8 KiB
Python
Raw Normal View History

import embedder
2023-08-01 17:02:54 +02:00
2023-08-01 02:39:20 +02:00
from nextcord import DMChannel
async def process(message):
2023-08-01 02:39:20 +02:00
text = message.content
2023-08-01 02:39:20 +02:00
# IGNORE BOTS
if message.author.bot:
return
2023-08-01 02:39:20 +02:00
# IGNORE DM CHANNELS
if isinstance(message.channel, DMChannel):
return
2023-08-12 01:59:02 +02:00
if text == '.empty':
return await message.channel.send('')
2023-08-01 02:39:20 +02:00
if 'N0V4x0SS' in text or 'T3BlbkFJ' in text:
2023-08-01 17:02:54 +02:00
censored_text = ''
for word in text.split():
if 'N0V4x0SS' in word or 'T3BlbkFJ' in word:
censored_text += '' * len(word)
else:
censored_text += word
censored_text += ' '
await embedder.warn(message, f"""{message.author.mention},
I think you sent an *OpenAI* or *NovaAI* key in here,
which could lead to other users accessing your API account without your knowledge.
Be very careful with API credentials!""", content=f'||{message.author.mention} sent (censored version):\n```{censored_text}```||', delete_after=60)
2023-08-01 02:39:20 +02:00
await message.delete()
# COMMANDS: WRONG CHANNEL
commands_allowed = ('commands' in message.channel.name) or (message.author.guild_permissions.manage_messages)
if text.startswith('/') and not commands_allowed:
2023-08-12 01:59:02 +02:00
await embedder.error(message, f'{message.author.mention}, please __only__ run commands in <#1133103276871667722>.', delete_after=10)
2023-08-01 02:39:20 +02:00
await message.delete()
return
# COMMANDS: NOT RAN CORRECTLY
if text.startswith('/') and len(text) > 2:
await embedder.warn(message, """Need help running commands? Check out
**https://nova-oss.com/novacord**!""", delete_after=10)
2023-08-01 17:02:54 +02:00
await message.delete()
2023-08-01 02:39:20 +02:00
return
2023-08-12 01:59:02 +02:00
if 'dQw4w9WgXcQ' in text:
await embedder.warn(message, """Hide your rickrolls better next time...""", delete_after=10)
await message.delete()
return