问题
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)
回答1:
You retrieve the channel a message was sent in by calling.
intro = ctx.channel
来源:https://stackoverflow.com/questions/65608857/how-do-i-get-the-channel-a-message-was-sent-in