Python Discord.py typeerror: Client.event() missing 1 required positional argument: 'coro' hatası

MadenSuyuTR

Decapat
Katılım
24 Ocak 2022
Mesajlar
111
Yer
Denizli
Daha fazla  
Sistem Özellikleri
/ Excalibur G770 / 8 GB RAM / 4GB VRAM GTX1650 / 500GB M.2 SDD / İ5-12450H 2.50GHZ / Windows 11 Home /
Cinsiyet
Erkek
Merhaba. Discord py de bot yapıyorum ama selam faktörü yapacaktım şu hatayı aldım: Typeerror: Client.event() missing 1 required positional argument: 'coro'.
Yardım eder misiniz?

Kod:
"
İmport Discord.
İmport Tkinter as tk.
İmport time.
İmport random.
From Discord. Ext import commands.
Selam = ["selam","Selam","slm","SELAM"]
Ownerid = ismim.
Bot = commands. Bot(command_prefix="Z!", intents=discord.Intents.all(), help_command=None)
[USER=272567]@Bot[/USER]. Event.
Async def on_ready():
 Activity = Discord. Game(name="*** Team", type = 3)
 Await bot. Change_presence(status = Discord. Status. Idle, activity = activity)
 Print("bot is ready!")

@Bot.command()
Async def tost(ctx):
 Await ctx.message.delete()
 Await ctx. Send("tost bir de çay üff mükemmel")
@Bot.command()
Async def say(ctx, *, message):
 Await ctx.message.delete()
 Await ctx. Send(message)
@Bot.command()
Async def yazı(ctx):
 Oyun = ["Yazı","Tura"]
 Rastgele = random. Choice(oyun)
 Await ctx. Send("yazı tura atılıyor")
 Time. Sleep(2)
 İf rastgele == "tura":
 Await ctx. Send("kaybettin tura çıktı")
 İf rastgele == "yazı":
 Await ctx. Send("kazandın yazı çıktı")
@Bot.command()
Async def tura(ctx):
 Oyun2 = ["Yazı","Tura"]
 Rastgele = random. Choice(oyun2)
 Await ctx. Send("yazı tura atılıyor")
 Time. Sleep(2)
 İf rastgele == "tura":
 Await ctx. Send("kazandın tura çıktı")
 İf rastgele == "yazı":
 Await ctx. Send("kaybettin yazı çıktı")
@Bot.command()
Async def botcoin(ctx):
 Botcoin = 0
 Botcoin = botcoin + 5
 Await ctx. Reply(F"5 adet bot coin cüdanda şu anki {botcoin}")
@Bot.command()
Async def help(ctx):
 Await ctx. Reply("------------------------help---------------------------------")
 Await ctx. Reply("-şu an 3 adet komut var-")
 Await ctx. Reply("-Z! Yazı (yazı tura olarak yazı oynatır)-")
 Await ctx. Reply("-Z! Tura (yazı tura olarak tura oynatır)-")
 Await ctx. Reply("-Z! Botcoin (Event olarak botcoin oyna her açılışta sıfırlanır)-")
 Await ctx. Reply("-------------------------------------------------------------")
@Bot.command()
@commands.is_owner()
Async def stop(context):
 exit()
@Bot.event()
Async def on_message(message):
 İf message. Content in selam:
 Await message. Channel. Send("selam gardaşım")
 Await bot. Process_commands(message)

Bot. Run("token")

Yazım denetiminden geçirdim hatalar olabilir.
 
Son düzenleyen: Moderatör:
Aşağıdaki kodu deneyiniz.

PHP:
import discord
import tkinter as tk
import time
import random
from discord.ext import commands

selam = ["selam", "Selam", "slm", "SELAM"]
bot = commands.Bot(command_prefix="Z!", intents=discord.Intents.all(), help_command=None)

@bot.event
async def on_ready():
    activity = discord.Game(name="*** Team", type=3)
    await bot.change_presence(status=discord.Status.idle, activity=activity)
    print("Bot is ready!")

@bot.command()
async def tost(ctx):
    await ctx.message.delete()
    await ctx.send("Tost bir de çay, üff mükemmel")

@bot.command()
async def say(ctx, *, message):
    await ctx.message.delete()
    await ctx.send(message)

@bot.command()
async def yazı(ctx):
    oyun = ["Yazı", "Tura"]
    rastgele = random.choice(oyun)
    await ctx.send("Yazı tura atılıyor")
    time.sleep(2)
    if rastgele == "Tura":
        await ctx.send("Kaybettin, tura çıktı")
    if rastgele == "Yazı":
        await ctx.send("Kazandın, yazı çıktı")

@bot.command()
async def tura(ctx):
    oyun2 = ["Yazı", "Tura"]
    rastgele = random.choice(oyun2)
    await ctx.send("Yazı tura atılıyor")
    time.sleep(2)
    if rastgele == "Tura":
        await ctx.send("Kazandın, tura çıktı")
    if rastgele == "Yazı":
        await ctx.send("Kaybettin, yazı çıktı")

@bot.command()
async def botcoin(ctx):
    botcoin = 0
    botcoin += 5
    await ctx.reply(f"5 adet bot coin cüzdanında, şu anki {botcoin}")

@bot.command()
async def help(ctx):
    await ctx.reply("------------------------help---------------------------------")
    await ctx.reply("-Şu an 3 adet komut var-")
    await ctx.reply("-Z! Yazı (yazı tura olarak yazı oynatır)-")
    await ctx.reply("-Z! Tura (yazı tura olarak tura oynatır)-")
    await ctx.reply("-Z! Botcoin (Event olarak botcoin oyna, her açılışta sıfırlanır)-")
    await ctx.reply("-------------------------------------------------------------")

@bot.command()
@commands.is_owner()
async def stop(ctx):
    await bot.logout()

@bot.event
async def on_message(message):
    if message.content.lower() in selam:
        await message.channel.send("Selam gardaşım")
    await bot.process_commands(message)

bot.run("token")
 
Hocam kodun
@Bot. Event.
Async def on_message(message):
İf message.content.lower() in selam:
Await message. Channel. Send("selam gardaşım")
Await bot. Process_commands(message) kısmı çalışmıyor.
 

Geri
Yukarı