Open Kaiasaurin opened 2 months ago
import discord
from discord.ext import commands
import hashlib
bot = commands.Bot(command_prefix='!')
def generate_key(user_id: int) -> str:
# Use SHA-256 to create a unique hash based on the user ID
key = hashlib.sha256(str(user_id).encode()).hexdigest()
return key
@bot.command()
async def getkey(ctx):
user_id = ctx.author.id
key = generate_key(user_id)
await ctx.author.send(f"Your unique key is: {key}")
bot.run('YOUR_BOT_TOKEN')
Creating new key for every user based on user id