import subprocess
import sys
import os
import random
import string
import json
from io import BytesIO
import requests
import nextcord
from nextcord import Interaction, File
from [Link] import commands
from nextcord import SlashOption
# Install required dependencies
try:
import requests
except ImportError:
print("Installing 'requests'...")
subprocess.check_call([[Link], "-m", "pip", "install", "requests"])
try:
import aiohttp
except ImportError:
print("Installing 'aiohttp'...")
subprocess.check_call([[Link], "-m", "pip", "install", "aiohttp"])
# Bot settings
ALLOWED_IDS = [1271345768665710667, 708605521065934900, 1251217809703305340,
1272007178441588779,
1226633929289760871, 1272261775659634721] # Replace with the IDs of
users allowed to use the command
STARBOARD_CHANNEL_ID = 1280296978655215616
STAR_EMOJI = "⭐"
STAR_THRESHOLD = 3
SERVER_ID = 1271929049761185832
MEME_CHANNEL_ID = 1280830092398039050
# Create the bot instance
intents = [Link]()
bot = [Link](command_prefix="/", intents=intents)
# Maintain starred messages
starred_messages = {}
@[Link]
async def on_ready():
print(f"Logged in as {[Link]}")
await
bot.change_presence(activity=[Link](type=[Link],
name="Humans"))
def create_embed(message, star_count):
embed = [Link](description=[Link] or "No content",
color=0xFFD700)
embed.set_author(name=[Link].display_name,
icon_url=[Link])
embed.add_field(name="Jump to message:", value=f"[Click
here]([Link]
{[Link]})", inline=False)
embed.set_footer(text=f"⭐ {star_count}")
# Add the first attachment if it exists
if [Link]:
embed.set_image(url=[Link][0].url)
return embed
@[Link]
async def on_raw_reaction_add(payload):
if payload.guild_id != SERVER_ID:
return
if [Link] == STAR_EMOJI:
channel = bot.get_channel(payload.channel_id)
message = await channel.fetch_message(payload.message_id)
starboard_channel = bot.get_channel(STARBOARD_CHANNEL_ID)
if [Link] in starred_messages:
embed_message = await
starboard_channel.fetch_message(starred_messages[[Link]])
star_count = next(([Link] for r in [Link] if [Link] ==
STAR_EMOJI), 0)
if star_count >= STAR_THRESHOLD:
embed = embed_message.embeds[0]
embed.set_footer(text=f"⭐ {star_count}")
await embed_message.edit(embed=embed)
else:
await embed_message.delete()
del starred_messages[[Link]]
else:
star_count = next(([Link] for r in [Link] if [Link] ==
STAR_EMOJI), 0)
if star_count >= STAR_THRESHOLD:
embed = create_embed(message, star_count)
embed_message = await starboard_channel.send(embed=embed)
starred_messages[[Link]] = embed_message.id
@[Link]
async def on_raw_reaction_remove(payload):
if [Link] == STAR_EMOJI:
channel = bot.get_channel(payload.channel_id)
message = await channel.fetch_message(payload.message_id)
starboard_channel = bot.get_channel(STARBOARD_CHANNEL_ID)
if [Link] in starred_messages:
embed_message = await
starboard_channel.fetch_message(starred_messages[[Link]])
star_count = next(([Link] for r in [Link] if [Link] ==
STAR_EMOJI), 0)
if star_count >= STAR_THRESHOLD:
embed = embed_message.embeds[0]
embed.set_footer(text=f"⭐ {star_count}")
await embed_message.edit(embed=embed)
else:
await embed_message.delete()
del starred_messages[[Link]]
@bot.slash_command(name="send", description="Send a message as the bot, with
multiple attachments.")
async def send_message(
interaction: Interaction,
message: str = SlashOption(description="The message to send."),
attachments: list[[Link]] = SlashOption(description="File
attachments.", required=False, default=[]),
urls: str = SlashOption(description="Comma-separated image URLs.",
required=False, default=None)
):
if [Link] not in ALLOWED_IDS:
await [Link].send_message("You are not allowed to use this
command.", ephemeral=True)
return
formatted_message = [Link]("\\n", "\n") # Handle newlines
files = []
# Process attachments uploaded as files
for attachment in attachments:
file = await attachment.to_file()
[Link](file)
# Process URLs provided
if urls:
url_list = [Link](",")
for url in url_list:
try:
response = [Link]([Link]())
if response.status_code == 200:
file_data = BytesIO([Link])
filename = [Link]().split("/")[-1]
[Link](File(file_data, filename=filename))
else:
await [Link].send_message(f"Failed to download
image from URL: {[Link]()}", ephemeral=True)
except Exception as e:
await [Link].send_message(f"Error downloading image
from URL {[Link]()}: {e}", ephemeral=True)
# Send the message with all files attached
if files:
await [Link](content=formatted_message, files=files)
await [Link].send_message("Message sent with attachments!",
ephemeral=True)
else:
await [Link](formatted_message)
await [Link].send_message("Message sent!", ephemeral=True)
# Additional commands
@bot.slash_command(name="send_embed", description="Send a customizable embed
message as the bot.")
async def send_embed(
interaction: Interaction,
title: str,
description: str,
colour: str = "#773303",
footer: str = ""
):
if [Link] not in ALLOWED_IDS:
await [Link].send_message("You are not allowed to use this
command.", ephemeral=True)
return
if not ([Link]("#") and len(colour) == 7 and all(c in
"0123456789abcdefABCDEF" for c in colour[1:])):
colour = "#dfeef5"
try:
embed_color = [Link](int([Link]("#"), 16))
except ValueError:
embed_color = [Link].from_rgb(223, 238, 245)
formatted_description = [Link]("\\n", "\n")
embed = [Link](
title=title,
description=formatted_description,
color=embed_color
)
if footer:
embed.set_footer(text=footer)
await [Link].send_message("Embed sent!", ephemeral=True)
await [Link](embed=embed)
@bot.slash_command(description="Impersonate a member")
async def impersonate(
interaction: Interaction,
person: [Link] = SlashOption(description="Select a member to
impersonate", required=True),
message: str = SlashOption(description="Message to send as the member",
required=True)
):
if [Link] not in ALLOWED_IDS:
await [Link].send_message("You are not allowed to use this
command.", ephemeral=True)
return
display_name = person.global_name if isinstance(person, [Link]) and
person.global_name else [Link]
display_name = display_name.split('#')[0]
channel = [Link]
await [Link].send_message(f"Sending message as
{display_name}...", ephemeral=True)
avatar = await [Link]() if [Link] else None
webhook = await channel.create_webhook(name=display_name, avatar=avatar)
await [Link](content=message)
await [Link]()
# More commands like dox, insult, compliment, etc. remain unchanged here
[Link]("YOUR_BOT_TOKEN")