#๐ My bot commands are duplicated in the command list.
15 messages ยท Page 1 of 1 (latest)
@oblique raptor
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
import discord
from discord.ext import commands
from discord import Embed
import datetime
import asyncio # To add a delay between sends to avoid rate limiting
from ifc_views import MyView # Ensure you import MyView
# Guild ID and embed color
GUILD_ID = discord.Object(id=1317926709517090878) # Replace with your actual guild ID
EMBED_COLOUR = 0x037bfc # You can change this to any color you prefer
# Setting up intents
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
# Creating the bot instance
client = commands.Bot(command_prefix="!", intents=intents)
@client.event
async def on_ready():
print(f'Logged in as {client.user}!')
# Sync commands once globally
try:
print("Syncing commands...")
await client.tree.sync() # Sync once, globally
print("Commands synced successfully.")
except Exception as e:
print(f"Error syncing commands: {e}")
# Register the 'freeagency' command (Slash Command Only)
@client.tree.command(name="freeagency", description="Get signed to a team!")
async def fa(interaction: discord.Interaction, position: str):
await interaction.response.send_message(f"Sent! :white_check_mark:", ephemeral=True)
channel = client.get_channel(1317926709517090881) or await client.fetch_channel(1317926709517090881)
embed = Embed(description=position, colour=EMBED_COLOUR)
embed.set_author(icon_url=interaction.user.avatar.url, name=interaction.user.name)
embed.set_footer(icon_url=interaction.guild.icon, text="International Football Confederation")
embed.timestamp = datetime.datetime.utcnow()
await channel.send(interaction.user.mention, embed=embed) ```
First thing is to make sure you dint have two bot processes running on your computer.
This is common to do if you run the script in your IDE - it might be still running in some other tab.
I've also seen people accidentally leave their bots running on pc while being out of the house with the laptop.
ye ive left my bot running while not being home
but Ive used my phone
i have closed and opened my visual studio
still showing up
you may have synced twice. does this problem exist in other servers?
also it's not a good idea to use channel.send as you can use interaction.response.send_message instead
interaction responses aren't ratelimited
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.