import os
import nextcord
from [Link] import commands
from nextcord import Interaction, SlashOption
import asyncio
intents = [Link]()
[Link] = True
intents.message_content = True
# Load secrets
token = [Link]('DISCORD_TOKEN')
channel_ids = [int(id) for id in [Link]('CHANNEL_IDS', '').split(',') if
[Link]()]
user_ids = [int(id) for id in [Link]('USER_IDS', '').split(',') if [Link]()]
# Validate variables
if not token:
raise ValueError("DISCORD_TOKEN is not set.")
if not channel_ids:
raise ValueError("CHANNEL_IDS is not set or improperly formatted.")
if not user_ids:
raise ValueError("USER_IDS is not set or improperly formatted.")
bot = [Link](command_prefix="!", intents=intents)
# Register Slash Commands
@bot.slash_command(name="ping", description="Responds with a cool Pong!")
async def ping(interaction: Interaction):
# Get bot latency (response time)
latency = round([Link] * 1000) # Convert latency to milliseconds
# Create a cool response with formatting and emojis
response = f"🏓 **Pong!**\nThe bot's latency is: `{latency} ms` 🚀"
# Send the response
await [Link].send_message(response)
# /say command: repeats the message provided by the user
@bot.slash_command(name="say", description="Make the bot say something")
async def say(interaction: Interaction, message: str = SlashOption(description="The
message to say")):
# Bot sends the message provided by the user
await [Link].send_message(message)
# /embed command: creates an embed with title, description, color, etc.
@bot.slash_command(name="embed", description="Create a custom embed")
async def embed(interaction: Interaction,
title: str = SlashOption(description="Embed title"),
description: str = SlashOption(description="Embed description"),
color: str = SlashOption(description="Embed color (e.g., red,
blue, green)", required=False, default="blue"),
footer: str = SlashOption(description="Footer text",
required=False, default="")):
# Convert color name to [Link]
color_dict = {
"red": [Link](),
"blue": [Link](),
"green": [Link](),
"purple": [Link](),
"yellow": [Link](),
"orange": [Link](),
}
embed_color = color_dict.get([Link](), [Link]()) # Default
to blue if the color is not found
# Create the embed
embed = [Link](title=title, description=description, color=embed_color)
if footer:
embed.set_footer(text=footer)
# Send the embed message
await [Link].send_message(embed=embed)
@[Link]
async def on_ready():
print(f"Logged in as {[Link]}")
@[Link]
async def on_message(message):
if [Link] in channel_ids:
if not [Link] and [Link] not in user_ids:
await [Link](0.2)
try:
await [Link]()
except [Link] as e:
print(f"Error deleting message: {e}")
except Exception as e:
print(f"General error: {e}")
await bot.process_commands(message)
[Link](token)