Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help discord bot
#1
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')
Error:
RuntimeWarning: coroutine 'send_msg' was never awaited self._target(*self._args, **self._kwargs) RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Creating Discord Bot: Unused import statement 'import discord EyeballCandy 0 3,564 Feb-02-2020, 10:53 PM
Last Post: EyeballCandy

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020