Answer the question
In order to leave comments, you need to log in
Writes what you need str doing str but does not work how to fix it?
The code:
@client.event
async def on_message(message):
channl = client.get_channel(781188134665846806)
chnsend = client.get_channel(788083527706214420)
author = message.author
print(type(channl))
if message.channel.id == 781188134665846806:
await channl.purge(limit = 1)
await chnsend.send('заявка от:' + author + 'текст:' + message)
2020-12-14T17:37:14.571102+00:00 app[worker.1]: await coro(*args, **kwargs)
2020-12-14T17:37:14.571160+00:00 app[worker.1]: File "bot.py", line 23, in on_message
2020-12-14T17:37:14.571162+00:00 app[worker.1]: await chnsend.send('заявка от:' + author + 'текст:' + message)
2020-12-14T17:37:14.571220+00:00 app[worker.1]: TypeError: must be str, not Message
Answer the question
In order to leave comments, you need to log in
You obviously do not have a string
Converting to a string is done through the str () function
str(message)
And it's better not to use it +
to join strings.
await chnsend.send('заявка от: {} текст: {}'.format(author, message))
Message is an object, that's why it swears, get the message text from there
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question