I need help with {server}
and with the {channel}
. I can't make the bot say the server name and the channel name.
@client.command()
async def whereami(ctx):
await ctx.send(f'You are on {server} on {channel}')
I need help with {server}
and with the {channel}
. I can't make the bot say the server name and the channel name.
@client.command()
async def whereami(ctx):
await ctx.send(f'You are on {server} on {channel}')
Copyright © 2021 Jogjafile Inc.
Server and channel is not defined. The ctx argument is an object which has two attributes which you are looking for; the guild and channel (guild is what they are called in Discord, not servers). So by using ctx.channel and ctx.guild you can access the guild and channel objects.
You can read more about all the attributes in the offical docs: discord.py docs