#how can I make a @tree.command working only on a specific guild id?
17 messages · Page 1 of 1 (latest)
from discord.ext import commands
bot = commands.Bot(command_prefix='!')
def guild_check(guild_id):
async def predicate(ctx):
return ctx.guild and ctx.guild.id == guild_id
return commands.check(predicate)
@guild_check(1234567890) # Replace with your specific guild ID
@bot.group()
async def tree(ctx):
if ctx.invoked_subcommand is None:
await ctx.send('Invalid tree command.')
@tree.command()
async def add(ctx, value):
# Logic for the add command
await ctx.send(f'Adding {value} to the tree.')
@tree.command()
async def remove(ctx, value):
# Logic for the remove command
await ctx.send(f'Removing {value} from the tree.')
bot.run('YOUR_BOT_TOKEN')`
Do you have any errors?
No
D
@spark galleon
Bruh
@spark galleon help plz
I think you are not the first person who wants to do this so just go to https://stackoverflow.com/ and look for help there.