Discord Bot can type in multiple channels and repeat the program

so i created a bot that generate stuff but i ran into a problem: how can i make the bot run in multiple channels at the same time?

Error code:
Ignoring exception in on_message
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 20, in on_message
    amount = int (message.content)
ValueError: invalid literal for int() with base 10: '!Start'

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

1 Like

it is saying that message.content is not a string that can be converted to a number because it has value of !Start

1 Like

do you know how to fix that?

I have no experience with discord bots, and not much with Python, but that said, even if I had, without seeing your code it’s a really difficult thing to do, like playing darts in the dark

import discord
import os
import random, string

client = discord.Client()

@client.event
async def on_ready():
  print ('We have logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
  if message.author == client.user:
    return

  if message.content.startswith('!test'):
    await message.channel.send('test')


client.run(os.getenv('TOKEN'))

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.