Reputation: 3
I have made a Discord.py Discord bot called JMKBot (version 4.0). When I use the bot.say() function, it says it wherever the user called it, for example
@bot.command()
async def example():
bot.say("example")
print("example command run!")
will say it in the same channel where I call >example.
But bot.send_message() requires a destination variable, and I cannot make it automatically go to the channel the command was called at.
How would I make the destination variable go to the channel the command was called at?
Upvotes: 0
Views: 545
Reputation: 61052
@bot.command(pass_context=True)
async def example(ctx):
await bot.send_message(ctx.message.channel, 'Example')
Pass the context into the command and then get the channel from the message
attribute.
Upvotes: 1