0% found this document useful (0 votes)
30 views3 pages

Message

This document contains a Discord bot implementation that manages user invitations and allows users to claim Fortnite accounts based on their invites. It includes functionalities for tracking invites, loading and saving account data, and responding to user interactions through buttons. The bot updates invite information when members join and provides feedback to users about their invite counts and account claims.

Uploaded by

robloxmk12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views3 pages

Message

This document contains a Discord bot implementation that manages user invitations and allows users to claim Fortnite accounts based on their invites. It includes functionalities for tracking invites, loading and saving account data, and responding to user interactions through buttons. The bot updates invite information when members join and provides feedback to users about their invite counts and account claims.

Uploaded by

robloxmk12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

import discord

from [Link] import commands


import random
import asyncio

TOKEN = "MTM1NzM1ODkxNTIyMTcyMTE2OA.Gou8Kv.vraNC9NLWfjfTFeRcduJgpvukagQDaz59Odu4o"
CHANNEL_ID = 1358812489986347040

intents = [Link]()
[Link] = True
[Link] = True
[Link] = True
[Link] = False
[Link] = True

bot = [Link](command_prefix="!", intents=intents)

user_invites = {}
previous_members = set()

async def actualizar_invites():


global user_invites
for guild in [Link]:
invites = await [Link]()
user_invites[[Link]] = {[Link]: ([Link], [Link]) for
invite in invites}

def cargar_cuentas():
try:
with open("[Link]", "r", encoding="utf-8") as f:
return [[Link]() for line in [Link]()]
except FileNotFoundError:
return []

def guardar_cuentas(cuentas):
with open("[Link]", "w", encoding="utf-8") as f:
[Link]("\n".join(cuentas))

@[Link]
async def on_ready():
print(f"Bot {[Link]} is online.")
await actualizar_invites()
print("Invites cache updated.")
channel = bot.get_channel(CHANNEL_ID)

if channel:
embed = [Link](
title="\U0001F381 Get Your Fortnite Account!",
description="Invite friends to the server and claim an account!",
color=0xA87DC2
)
embed.set_image(url="[Link]
view = AccountView()
await [Link](embed=embed, view=view)

@[Link]
async def on_member_join(member):
global user_invites, previous_members
guild = [Link]
if [Link] in previous_members:
print(f"{[Link]} ha vuelto a unirse. No se contará la invitación.")
return

old_invites = user_invites.get([Link], {}).copy()

await actualizar_invites()

new_invites = user_invites.get([Link], {})

inviter_id = None

for invite_code, (inviter, uses) in new_invites.items():


if invite_code in old_invites:
old_uses = old_invites[invite_code][1]
if uses > old_uses:
inviter_id = inviter
break

previous_members.add([Link])

if inviter_id:
if inviter_id not in user_invites[[Link]]:
user_invites[[Link]][inviter_id] = 0
user_invites[[Link]][inviter_id] += 1
print(f"{[Link]} fue invitado por {inviter_id}. Ahora tiene
{user_invites[[Link]][inviter_id]} invitaciones.")

async def obtener_invitaciones(user):


return user_invites.get([Link], {}).get([Link], 0)

class AccountView([Link]):
def __init__(self):
super().__init__(timeout=None)

@[Link](label="Get Account", style=[Link])


async def get_account(self, interaction: [Link], button:
[Link]):
invites = await obtener_invitaciones([Link])

if invites <= 0:
await [Link].send_message("You don't have enough invites
to claim an account.", ephemeral=True)
return

cuentas = cargar_cuentas()
if not cuentas:
await [Link].send_message("No accounts available right
now.", ephemeral=True)
return

cuenta = [Link](cuentas)
[Link](cuenta)
guardar_cuentas(cuentas)

user_invites[[Link]][[Link]] -= 1
await [Link].send_message(f"Here is your Fortnite account:
`{cuenta}`", ephemeral=True)
@[Link](label="Check Invites", style=[Link])
async def check_invites(self, interaction: [Link], button:
[Link]):
"""Muestra cuántas invitaciones tiene el usuario."""
invites = await obtener_invitaciones([Link])
await [Link].send_message(f"You have {invites} invites. Keep
inviting to claim more accounts!", ephemeral=True)

[Link](TOKEN)

You might also like