Message
Message
import aiohttp
import discord
from discord.ui import Select
from discord import SelectOption, ui, app_commands
from datetime import datetime, timedelta
from uuid import uuid4 # gen random guid
from addons.buttons import TestButtons
from pystyle import Colors
import os
import asyncio # asyncio needs to be imported
def clear():
os.system('cls' if os.name == 'nt' else 'clear')
intents = discord.Intents.all()
aclient = Client(intents=intents) # Using the corrected class name
tree = app_commands.CommandTree(aclient)
role_brand_mapping = {
284862516635238420: "StockX",
1284862551334846484: "Farfetch",
1284862568430702725: "Balenciaga",
1284862587154202714: "Bape",
1284862615687790623: "Apple",
1284862668909576212: "Stüssy",
1284862691860811876: "JD Sports",
1284862719849136209: "Nike",
1284862733883539488: "Prada",
1284862747623817286: "Trapstar",
1284862761939111949: "NoSauceThePlug",
1284862791139983400: "Corteiz",
1284862801218764882: "The North Face"
}
if brand_names:
if len(brand_names) == len(role_brand_mapping):
embed = discord.Embed(title="Lua Receipt Gen",
description=f'{interaction.user} please select your brand.\n\
n<:info:1229841278037004349> You have a subscription for `all` brands',
color=0x1e1f22)
else:
brand_count = len(brand_names)
embed = discord.Embed(title="Lua Receipt Gen",
description=f'{interaction.user} please select your brand.\n\
n<:info:1229841278037004349> You have a subscription for `{brand_count}` brands',
color=0x1e1f22)
else:
embed = discord.Embed(title="Lua Receipt Gen",
description=f'{interaction.user} please select your brand.\n\
n<:crosss:1229840828651016253> You have currently no access.', color=0x1e1f22)
embed.set_footer(text=f'{interaction.user}`s Panel')
embed.set_thumbnail(url='https://cdn.discordapp.com/attachments/1229782496057626666
/1231184806155386890/brandmark-design_5.png')
buttons_view = TestButtons(owner_id)
await interaction.response.send_message(embed=embed, view=buttons_view)
# Continue with the Utils and other command functions, using the corrected config
loading method
class Utils:
@staticmethod
async def is_whitelisted(user_id: int) -> bool:
with open("whitelist.txt", "r") as f:
whitelisted_users = f.read().splitlines()
return str(user_id) in whitelisted_users
@staticmethod
async def add_to_whitelist(user_id: int) -> bool:
with open("whitelist.txt", "r+") as f:
whitelisted_users = f.read().splitlines()
if str(user_id) in whitelisted_users:
return False
f.write(str(user_id) + "\n")
return True
@staticmethod
async def remove_from_whitelist(user_id: int) -> bool:
with open("whitelist.txt", "r+") as f:
lines = f.readlines()
f.seek(0)
user_removed = False
for line in lines:
if str(user_id) not in line.strip():
f.write(line)
else:
user_removed = True
f.truncate()
return user_removed
# Load the `config` inside each command as needed, and avoid missing definitions or
imports.
# Also, adjust the interaction responses where needed to make sure correct config
data is handled.