import discord from discord.ext import bridge import mysql.connector intents = discord.Intents.default() intents.message_content = True bot = bridge.Bot(command_prefix="yarrakhwid", intents=intents) ####################### - DB Bağlantısı - ####################### db = mysql.connector.connect( host="", user="", password="", database="" ) cursor = db.cursor() # ####################### - Doğrula - ####################### @bot.bridge_command() async def dogrula(ctx, hwid: str): discord_id = ctx.author.id name = ctx.author.name cursor.execute("SELECT * FROM hwiddata WHERE hwid = %s", (hwid,)) hwidmevcut = cursor.fetchone() if hwidmevcut: embed = discord.Embed( title="Hata", description="Bu HWID zaten doğrulanmış.", color=discord.Color.red() ) await ctx.respond(embed=embed) return cursor.execute("SELECT * FROM hwiddata WHERE discord_id = %s", (discord_id,)) kullanicimevcut = cursor.fetchone() if kullanicimevcut: embed = discord.Embed( title="Hata", description="Sadece 1 Adet HWID doğrulayabilirsin.", color=discord.Color.red() ) await ctx.respond(embed=embed) return try: cursor.execute( "INSERT INTO hwiddata (kullanici, discord_id, hwid) VALUES (%s, %s, %s)", (name, discord_id, hwid) ) db.commit() embed = discord.Embed( title="HWID Kayıt Edildi", description="HWID doğrulandı!", color=discord.Color.green() ) embed.add_field(name="Kullanıcı", value=name, inline=True) embed.add_field(name="HWID", value=hwid, inline=True) await ctx.respond(embed=embed) except mysql.connector.Error as err: embed = discord.Embed( title="Hata", description=f"{err}", color=discord.Color.red() ) await ctx.respond(embed=embed) # ####################### - Sıfırla - ####################### @bot.bridge_command() async def sifirla(ctx): discord_id = ctx.author.id cursor.execute("SELECT * FROM hwiddata WHERE discord_id = %s", (discord_id,)) kayitlihwidyok = cursor.fetchone() if not kayitlihwidyok: embed = discord.Embed( title="Hata", description="Kayıtlı bir HWID bulunamadı.", color=discord.Color.red() ) await ctx.respond(embed=embed) return cursor.execute("DELETE FROM hwiddata WHERE discord_id = %s", (discord_id,)) db.commit() embed = discord.Embed( title="Başarılı", description="HWID başarıyla sıfırlandı.", color=discord.Color.green() ) await ctx.respond(embed=embed) ####################### - Calıstır - ####################### bot.run("TOKENI UNUTMAM.") ####################### - Calıstır - #######################