235baron
235baron

Reputation: 57

How do I get the channel a message was sent in?

I have been trying and making and building some channel lockdown commands, but they all didn't work. So far, I only have a lockdown command which locks a specific, fixed channel (code down below). So could someone tell me how to make a lockdown command which locks the channel the command was sent in?

@bot.command(aliases=['sd'])
@commands.has_role('Admin')
async def shutdown(ctx):
    """Shuts down #bank"""
    intro = bot.get_channel(768788764008251436)
    await intro.set_permissions(ctx.guild.default_role, send_messages=False)

Upvotes: 1

Views: 136

Answers (1)

chluebi
chluebi

Reputation: 1829

You retrieve the channel a message was sent in by calling.

intro = ctx.channel

Upvotes: 2

Related Questions