Discord.py kodundaki hata nedir?

DrBr1ll14nt

Decapat
Katılım
7 Eylül 2023
Mesajlar
45
Yer
Bursa/Nilüfer
Daha fazla  
Sistem Özellikleri
Nvidia GTX 1650OC Asus Phoneix
İntel Core İ3-10100F
16 GB Corsair RAM
ADATA SU630 960GB Sata SSD
Asus Anakart (Modelini Hatırlamıyorum)
Cinsiyet
Erkek
Meslek
Öğrenci
Python:
import discord.
from discord.ext import commands.
class MyClient(discord.Client):
 async def on_ready(self):
 print(f'{self.user} Giris yapti!')
 async def on_message(self, message):
 print(f'{message.author} Adli kisiden mesaj var: {message.content}')
intents = discord.Intents.default()
intents.message_content = True.
bot = commands.Bot(command_prefix='!', intents=intents)
@bot.command()
async def test(ctx, arg):
 await ctx.send(arg)
bot.add_command(test)
client = MyClient(intents=intents)
client.run('token')

Kodunda şöyle bir hata alıyorum:

Kod:
Traceback (most recent call last):
 File "c:\Users\kaank\Desktop\kozmos.py\main.py", line 20, in <module>
 bot.add_command(test)
 ~~~~~~~~~~~~~~~^^^^^^
 File "C:\Users\kaank\AppData\Local\Programs\Python\Python313\Lib\site-packages\discord\ext\commands\bot.py", line 253, in add_command.
 super().add_command(command)
 ~~~~~~~~~~~~~~~~~~~^^^^^^^^^
 File "C:\Users\kaank\AppData\Local\Programs\Python\Python313\Lib\site-packages\discord\ext\commands\core.py", line 1356, in add_command.
 raise CommandRegistrationError(command.name)
discord.ext.commands.errors.CommandRegistrationError: The command test is already an existing command or alias.

Bunun çözümü nedir yardımcı olur musunuz?
 
Şu şekilde dener misiniz;

Python:
import discord
from discord.ext import commands

class MyClient(discord.Client):
 async def on_ready(self):
 print(f'{self.user} giriş yaptı!')

 async def on_message(self, message):
 print(f'{message.author} adlı kişiden mesaj var: {message.content}')

# Bot için intent ayarları
intents = discord.Intents.default()
intents.message_content = True

# Bot'u oluşturma
bot = commands.Bot(command_prefix='!', intents=intents)

@bot.command()
async def test(ctx, arg):
 await ctx.send(arg)

# Bot'u çalıştırma
bot.run('token')
 
Şu şekilde dener misiniz;

Python:
import discord
from discord.ext import commands

class MyClient(discord.Client):
 async def on_ready(self):
 print(f'{self.user} giriş yaptı!')

 async def on_message(self, message):
 print(f'{message.author} adlı kişiden mesaj var: {message.content}')

# Bot için intent ayarları
intents = discord.Intents.default()
intents.message_content = True

# Bot'u oluşturma
bot = commands.Bot(command_prefix='!', intents=intents)

@bot.command()
async def test(ctx, arg):
 await ctx.send(arg)

# Bot'u çalıştırma
bot.run('token')
[/CO
[/QUOTE]
Çok teşekkür ederim oldu :D
 

Technopat Haberler

Yeni konular

Geri
Yukarı