AnswerBun.com

How can I send a message to a specific channel?

Stack Overflow Asked by Tuna Ariyurek on November 27, 2020

@client.event
async def on_message_delete(message):
    content = message.content
    author = message.author
    await message.channel.send("{}: {}".format(author, content))

I searched for it but I could not find any result. I tried to use client.get_channel("id") it gives typerror i tried to convert it to int but still it didnt work.
Can you help?

One Answer

TO send the retrieved data to specific guild and channel

specific_guild = client.get_guild( guild_id )#guild_id must be a integer
specific_channel = specific_guild.get_channel( channel_id )#channel_id must be a integer
await specific_channel.send("{}: {}".format(author, content))

To send the retrieved data to a specific channel in the same guild

specific_channel = message.guild.get_channel( channel_id )#channel_id must be a integer
await specific_channel.send("{}: {}".format(author, content))

Correct answer by Manoj A on November 27, 2020

Add your own answers!

Related Questions

form validation with data ranges

2  Asked on August 7, 2020 by eniol

   

How to format this output?

2  Asked on August 6, 2020 by shantanu-jain

     

uploading csv file django using a form

2  Asked on August 5, 2020 by sheraram_prajapat

       

Set focus to another Control

3  Asked on August 4, 2020 by binu

 

Animate gradient bar chart – matplotlib

1  Asked on August 4, 2020 by jonboy

       

c# error – Can not convert Array to byte array

1  Asked on August 2, 2020 by rakesh

         

Correcting Business name misspellings

1  Asked on August 2, 2020 by jonathan-rauscher

     

How to cut a string to the first “/” from right to left c# .net

1  Asked on August 1, 2020 by ignacio-gomez

   

Inserting random data from a list

2  Asked on August 1, 2020 by smiley

     

Invalid token SELECT

2  Asked on July 31, 2020 by virendra-varma

     

Django – No column found for custom field?

0  Asked on July 29, 2020 by jare42

       

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir