Checking What channel a message was sent in, discord.py

Viewed 471

i am making a message logger for fun and i wanted to know if with it saying what was said and who said it if i could see what channel it was in and print it, here is the logger, everything works I just wanted to add specification of channel.

code:

async def on_message(message):
  msg = message.content
  hook.send(f'|{message.author.name}|{msg}')```
2 Answers
async def on_message(message):
  msg = message.content
  channel = message.channel
  hook.send(f'|{message.author.name}|{msg}')

It is all in the docs. If you want to also mention the channel in the a message, then just message.channel.mention

Related