Python discord.py komut ekleyemiyorum

Crypex

Decapat
Katılım
22 Ekim 2020
Mesajlar
13
Daha fazla  
Cinsiyet
Erkek
Selam discord botu için discord.py kullanmayi başlamıştım ama en başından beridir şuna bir çözüm bulamadım hata :


@client.command() ^^^^^^^^^^^^^^ AttributeError: 'Client' object has no attribute 'command' kod: # bot.py import os import discord from discord import app_commands from discord.ext import commands from discord.ext.commands import Bot client = discord.Client(command_prefix="?", intents = discord.Intents.all()) @client.event async def on_ready(): print(f'{client.user} has connected to Discord!') @client.command() async def help(ctx): await ctx.reply('''-- bot -- ?start --> start bot ?stop --> stop bot ''') @client.comand() async def stop(ctx): await ctx.reply(''' > **closing || Log Out Successfully**''') client.run(token)
 
Son düzenleyen: Moderatör:
Selam discord botu için discord.py kullanmayi başlamıştım ama en başından beridir şuna bir çözüm bulamadım hata :


@client.command() ^^^^^^^^^^^^^^ AttributeError: 'Client' object has no attribute 'command' kod: # bot.py import os import discord from discord import app_commands from discord.ext import commands from discord.ext.commands import Bot client = discord.Client(command_prefix="?", intents = discord.Intents.all()) @client.event async def on_ready(): print(f'{client.user} has connected to Discord!') @client.command() async def help(ctx): await ctx.reply('''-- bot -- ?start --> start bot ?stop --> stop bot ''') @client.comand() async def stop(ctx): await ctx.reply(''' > **closing || Log Out Successfully**''') client.run(token)
Hatanın bulunduğu satır nedir?

Gerek kalmadı hocam.

client = discord.Client(command_prefix="?", intents = discord.Intents.all())

Burdaki satırı;

client = discord.Bot(command_prefix="?", intents = discord.Intents.all())

şeklinde değiştirin.
 
Selam discord botu için discord.py kullanmayi başlamıştım ama en başından beridir şuna bir çözüm bulamadım hata :


@client.command() ^^^^^^^^^^^^^^ AttributeError: 'Client' object has no attribute 'command' kod: # bot.py import os import discord from discord import app_commands from discord.ext import commands from discord.ext.commands import Bot client = discord.Client(command_prefix="?", intents = discord.Intents.all()) @client.event async def on_ready(): print(f'{client.user} has connected to Discord!') @client.command() async def help(ctx): await ctx.reply('''-- bot -- ?start --> start bot ?stop --> stop bot ''') @client.comand() async def stop(ctx): await ctx.reply(''' > **closing || Log Out Successfully**''') client.run(token)
Bu hatayı düzeltmek için, 'stop' fonksiyonunda @client.command() yerine @client.comand() yazmış olduğunuz yeri düzgün olarak @client.command() olarak değiştirin.

@client.comand()

Bir deneyin bakalım. Olmazsa yazarsanız.
 
Bu hatayı düzeltmek için, 'stop' fonksiyonunda @client.command() yerine @client.comand() yazmış olduğunuz yeri düzgün olarak @client.command() olarak değiştirin.



Bir deneyin bakalım. Olmazsa yazarsanız.
Önce sizin dediğinizi denedim şu hatayı aldım
Hata:

AttributeError: 'Client' object has no attribute 'command'

Sonra üstteki hocamın dediğini uyguladım onu uygulayincada su hatayi aldım
Hata:

AttributeError: module 'discord' has no attribute 'Bot'

Farklı bir sürüm mu denemeliyim acaba
 
Önce sizin dediğinizi denedim şu hatayı aldım
Hata:

AttributeError: 'Client' object has no attribute 'command'

Sonra üstteki hocamın dediğini uyguladım onu uygulayincada su hatayi aldım
Hata:

AttributeError: module 'discord' has no attribute 'Bot'

Farklı bir sürüm mu denemeliyim acaba
import discord

client = discord.Bot() # Hataya neden olur
Bu gibi bir şey varsa kod içinde bunu
import discord

client = discord.Client()
Olarak değiştirin.
 
import discord

client = discord.Bot() # Hataya neden olur
Bu gibi bir şey varsa kod içinde bunu
import discord

client = discord.Client()
Olarak değiştirin.
Yeni hata:

AttributeError: 'Command' object has no attribute 'run'

bot.run(token) kısmı çalışmıyor

Düzelttim. Sürüm yüzündenmiş yardımcı olan tüm arkadaşlara teşekkürler.
 
Son düzenleme:

Yeni konular

Geri
Yukarı