'"'Command.__call__' was never awaited" when trying to execute Discord bot command on Tkinter button click
I've been trying to create a Discord self bot which posts a message in a specific channel based off a button input on another program. But I receive this error:
RuntimeWarning: coroutine
Command.__call__
was never awaited
How can I solve this?
import tkinter as tk
from discord.ext import commands
import asyncio
bot = commands.Bot('', self_bot=True)
@bot.command()
async def on_command():
channel = bot.get_channel('ID')
await channel.send('Message')
root = tk.Tk()
root.title("Test")
root.geometry("1280x720")
root.configure(background="#161616")
pathBtn = tk.Button(
root, height=1, width=10, text="Text", background="#282828",
command=lambda: on_command()
).pack()
spaceLabel = tk.Label(root, text="", height=1, background="#161616").pack()
root.mainloop()
bot.run("TOKEN", bot=False)
Solution 1:[1]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | mkrieger1 |