Answer the question
In order to leave comments, you need to log in
How to make a repeat bot, but in a channel of your choice?
I have written the following command with which the message is repeated in another channel. But the fact is that only the first word after the id is sent, which I certainly understand, but the question is, is it possible to somehow send the full text to another channel to choose from on behalf of the bot, writing it in the discord chat?
async def message(self, idc: int, text):
channel = self.client.get_channel(idc)
await channel.send(text)
Answer the question
In order to leave comments, you need to log in
You are getting the first argument from the message, and you need to get the whole message. There are two options.
(How it works for you.)
>There were< two geese and a bun
In order for your bot to accept the desired text and send it at once, you need to wrap everything you need in quotes: '
>'There were two geese and a bun'<
In this case, everything will be received message in quotes, not just the first word.
I also whipped up the implementation of sending the message to the selected channel, where we get all the content of the message.
@bot.command()
async def forward(ctx, name_channel=None):
# Получаем id канала по его названию.
for channel in ctx.guild.channels:
if channel.name == name_channel:
channel = bot.get_channel(channel.id)
# Получаем все содержание сообщения и отсылаем его в нужный нам канал.
content = ctx.message.content
await channel.send(content)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question