Help discord bot - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Help discord bot (/thread-38206.html) |
Help discord bot - Edward - Sep-15-2022 Hello! At a command "test" call writes an error in a stream. Help fix from re import M import discord, asyncio from discord.ext import commands from threading import Thread intents = discord.Intents.default() intents.message_content = True bot = commands.Bot(command_prefix='/', intents=intents) async def send_msg(channel, text): channel = bot.get_channel(channel) await channel.send(text) @bot.command() async def test (ctx, channel, text): th1 = Thread(target=send_msg, args=(channel, text)) th1.start() bot.run('bot_token')
|