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

Bot Code

Uploaded by

poonamahuja750
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)
112 views3 pages

Bot Code

Uploaded by

poonamahuja750
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
You are on page 1/ 3

import discord

from discord.ext import commands


import os, random

# === CONFIGURATION ===


GEN_CHANNEL_ID = 1396881025765736499 # Replace with your target channel ID
GEN_ROLE_NAME = "Gen Access"
STATUS_KEYWORD = ".gg/T8dACk9TCB"
STOCK_FOLDER = "stock"
TOKEN = "" # Paste your actual bot token here

# === INTENTS SETUP ===


intents = discord.Intents.default()
intents.message_content = True
intents.presences = True
intents.members = True

client = commands.Bot(command_prefix="$", intents=intents)

# === ON READY ===


@client.event
async def on_ready():
print(f"✅ Bot is online as {client.user}")

# === CHECK STATUS AND ASSIGN ROLE ===


@client.command()
async def cstatus(ctx):
if ctx.channel.id != GEN_CHANNEL_ID:
await ctx.send(f"🚫 Use this in <#{GEN_CHANNEL_ID}> only.")
return

member = ctx.author
for activity in member.activities:
if isinstance(activity, discord.CustomActivity) and activity.name:
if STATUS_KEYWORD in activity.name:
role = discord.utils.get(ctx.guild.roles, name=GEN_ROLE_NAME)
if role:
await member.add_roles(role)
embed = discord.Embed(
title="🔓 Gen Access Granted!",
description="You're now eligible to use `$free` commands.
In https://discord.com/channels/1388930994182033488/1396881025765736499" But Make
Sure You Can Only Generate 1 Acc0unt Per 15 Min If u try to generate under the time
the bot will not respond you,
color=0x00ff99
)
await ctx.send(embed=embed)
return
await ctx.send("🛑 Update your custom status with:\n`.gg/T8dACk9TCB : The best
Rewards and giveaways server`")

# === REWARD GENERATION ===


@client.command()
@commands.cooldown(1, 900, commands.BucketType.user) # 15-minute cooldown
async def free(ctx, service: str):
if ctx.channel.id != GEN_CHANNEL_ID:
await ctx.send(f"🚫 Use this in <#{GEN_CHANNEL_ID}> only.")
return
member = ctx.author
role = discord.utils.get(ctx.guild.roles, name=GEN_ROLE_NAME)

if not role or role not in member.roles:


embed = discord.Embed(
title="🔐 Access Denied",
description="You need the Gen Access role.\nRun `$cstatus` after
setting your status.",
color=0xff4444
)
await ctx.send(embed=embed)
return

stock_path = os.path.join(STOCK_FOLDER, f"{service.lower()}.txt")


used_path = "used.txt"

if not os.path.exists(stock_path):
await ctx.send("❌ Service not found.")
return

with open(stock_path, "r") as file:


items = [line.strip() for line in file if line.strip()]

if not items:
await ctx.send("📦 Stock is empty! We Will Restock And Notify As Soon As
Possible !!")
return

selected = random.choice(items)
items.remove(selected)

# Rewrite stock and log used


with open(stock_path, "w") as f:
f.write("\n".join(items))
with open(used_path, "a") as used:
used.write(selected + "\n")

embed = discord.Embed(title=f"🎁 Your {service.capitalize()} Account",


description=f"`{selected}`", color=0x00ffff)
embed.set_footer(text="Gen Bot • Use responsibly")
await member.send(embed=embed)
await ctx.send("✅ Checkout Your DM! And Make Sure To Vouch The Bot In
https://discord.com/channels/1388930994182033488/1396033305714884619 If Did'nt
Vouched Then Ban From Using The Gen , Also Vouch Format : Legit Got MCFA From
<1396884595001004182>")

# === AESTHETIC STOCK PANEL ===


@client.command()
async def stock(ctx):
if ctx.channel.id != GEN_CHANNEL_ID:
await ctx.send(f"🚫 Use this in <#{GEN_CHANNEL_ID}> only.")
return

vaults = {
"Freemium Vault 🔓": {
"Minecraft": "minecraft.txt",
"Mc_Bedrock": "mc_bedrock.txt"
},
"Booster Vault 🚀": {
"Cape": "cape.txt",
"Xbox": "xbox.txt",
"Unbanned": "unbanned.txt",
"Rank": "rank.txt"
},
"Premium Vault 💎": {
"Mcfa": "mcfa.txt"
}
}

embed = discord.Embed(
title="📦 LitCloud Inventory",
description="Here’s what’s in stock across the vaults:",
color=0x00ffaa
)

for vault, items in vaults.items():


section = ""
for name, filename in items.items():
path = os.path.join(STOCK_FOLDER, filename)
count = 0
if os.path.exists(path):
with open(path, "r") as f:
count = len([line for line in f if line.strip()])
section += f"🔹 **{name}** → `[ {count} Units ]`\n"
embed.add_field(name=vault, value=section, inline=False)

embed.set_footer(text="✨ LitCloud • Made With ♥️By VedOG")


await ctx.send(embed=embed)

# === AUTO REMOVE ROLE IF STATUS IS REMOVED ===


@client.event
async def on_presence_update(before, after):
member = after
role = discord.utils.get(member.guild.roles, name=GEN_ROLE_NAME)
has_role = role in member.roles if role else False

status_text = ""
for activity in member.activities:
if isinstance(activity, discord.CustomActivity):
status_text = activity.name or ""

if has_role and STATUS_KEYWORD not in status_text:


await member.remove_roles(role)
print(f"🧼 Removed Gen Access from {member.display_name}")

# === 🔚 BOT TOKEN RUNNER ===


client.run(TOKEN)

You might also like