Small improvements

This commit is contained in:
nsde 2023-08-01 17:02:54 +02:00
parent e8bc01fbf5
commit 8580f52d01
3 changed files with 24 additions and 2 deletions

View file

@ -1,4 +1,6 @@
import embedder import embedder
from nextcord import DMChannel from nextcord import DMChannel
async def process(message): async def process(message):
@ -13,7 +15,19 @@ async def process(message):
return return
if 'N0V4x0SS' in text or 'T3BlbkFJ' in text: if 'N0V4x0SS' in text or 'T3BlbkFJ' in 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!', delete_after=15) 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)
await message.delete() await message.delete()
# COMMANDS: WRONG CHANNEL # COMMANDS: WRONG CHANNEL
@ -28,4 +42,5 @@ async def process(message):
if text.startswith('/') and len(text) > 2: if text.startswith('/') and len(text) > 2:
await embedder.warn(message, """Need help running commands? Check out await embedder.warn(message, """Need help running commands? Check out
**https://nova-oss.com/novacord**!""", delete_after=10) **https://nova-oss.com/novacord**!""", delete_after=10)
await message.delete()
return return

View file

@ -66,4 +66,12 @@ async def leaderboard(interaction: nextcord.Interaction):
async def account(interaction: nextcord.Interaction): async def account(interaction: nextcord.Interaction):
return await accounts.get_account(interaction) return await accounts.get_account(interaction)
@bot.slash_command(description='Lookup members by their Discord ID.')
async def lookup(interaction: nextcord.Interaction,
discord_id: int = SlashOption(description='Discord ID', required=True)
):
for member in interaction.guild.members:
if str(member.id).startswith(str(discord_id)):
return await embedder.ok(interaction, f'Result: {member.mention} (`{member.id}`)')
bot.run(os.getenv('DISCORD_TOKEN')) bot.run(os.getenv('DISCORD_TOKEN'))

View file

@ -11,7 +11,6 @@ from dotenv import load_dotenv
load_dotenv() load_dotenv()
async def get_credentials(interaction): async def get_credentials(interaction):
for _ in range(2): for _ in range(2):
try: try: