egfw

egfw boost bot

Jan 27th, 2024
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 34.11 KB | None | 0 0
  1. import discord
  2. from discord.ui import button
  3. import json, httpx, tls_client, threading, time, random, hashlib, sys, os
  4. from flask import request, Flask, jsonify
  5. from keyauth import api
  6.  
  7. class Fore:
  8.     BLACK = "\033[30m"
  9.     RED = "\033[31m"
  10.     GREEN = "\033[32m"
  11.     YELLOW = "\033[33m"
  12.     BLUE = "\033[34m"
  13.     MAGENTA = "\033[35m"
  14.     CYAN = "\033[36m"
  15.     WHITE = "\033[37m"
  16.     UNDERLINE = "\033[4m"
  17.     RESET = "\033[0m"
  18.  
  19.  
  20. easyboosts = """
  21. ██╗░░░░░███████╗░█████╗░███╗░░██╗  ██████╗░░█████╗░░█████╗░░██████╗████████╗  ██████╗░░█████╗░████████╗
  22. ██║░░░░░██╔════╝██╔══██╗████╗░██║  ██╔══██╗██╔══██╗██╔══██╗██╔════╝╚══██╔══╝  ██╔══██╗██╔══██╗╚══██╔══╝
  23. ██║░░░░░█████╗░░██║░░██║██╔██╗██║  ██████╦╝██║░░██║██║░░██║╚█████╗░░░░██║░░░  ██████╦╝██║░░██║░░░██║░░░
  24. ██║░░░░░██╔══╝░░██║░░██║██║╚████║  ██╔══██╗██║░░██║██║░░██║░╚═══██╗░░░██║░░░  ██╔══██╗██║░░██║░░░██║░░░
  25. ███████╗███████╗╚█████╔╝██║░╚███║  ██████╦╝╚█████╔╝╚█████╔╝██████╔╝░░░██║░░░  ██████╦╝╚█████╔╝░░░██║░░░
  26. ╚══════╝╚══════╝░╚════╝░╚═╝░░╚══╝  ╚═════╝░░╚════╝░░╚════╝░╚═════╝░░░░╚═╝░░░  ╚═════╝░░╚════╝░░░░╚═╝░░░
  27. """
  28.  
  29. leonop = """➤ BUY THE BOOST FROM LEON SHOP"""
  30.  
  31. print(f'{Fore.CYAN}{easyboosts}{Fore.RESET}')
  32. print(f'{Fore.CYAN}{leonop}{Fore.RESET}')
  33.  
  34. os.system("title " + "LEON BOOST BOT")
  35.  
  36. app = Flask(__name__)
  37.  
  38. def getchecksum():
  39.     md5_hash = hashlib.md5()
  40.     file = open(''.join(sys.argv), "rb")
  41.     md5_hash.update(file.read())
  42.     digest = md5_hash.hexdigest()
  43.     return digest
  44.  
  45. keyauthapp = api(
  46.     name = "Leon Boost Bot",
  47.     ownerid = "yleAXdXyfl",
  48.     secret = "52fb8ff1f3d66d722a474c086870f1b8551b087ca3c663e50e6e30196f1a38dc",
  49.     version = "1.0",
  50.     hash_to_check = getchecksum()
  51. )
  52.  
  53. config = json.load(open("config.json", encoding="utf-8"))
  54.  
  55.  
  56. key = input(f'{Fore.CYAN}ENTER THE LICENSE KEY:{Fore.RESET} ')
  57. keyauthapp.license(key)
  58.  
  59.  
  60. class Booster:
  61.     def __init__(self) -> None:
  62.         self.proxy = self.getProxy()
  63.         self.getCookies()
  64.         self.client = tls_client.Session(
  65.             client_identifier="chrome_107",
  66.             ja3_string="771,4866-4867-4865-49196-49200-49195-49199-52393-52392-49327-49325-49188-49192-49162-49172-163-159-49315-49311-162-158-49314-49310-107-106-103-64-57-56-51-50-157-156-52394-49326-49324-49187-49191-49161-49171-49313-49309-49233-49312-49308-49232-61-192-60-186-53-132-47-65-49239-49235-49238-49234-196-195-190-189-136-135-69-68-255,0-11-10-35-16-22-23-49-13-43-45-51-21,29-23-30-25-24,0-1-2",
  67.             h2_settings={
  68.                 "HEADER_TABLE_SIZE": 65536,
  69.                 "MAX_CONCURRENT_STREAMS": 1000,
  70.                 "INITIAL_WINDOW_SIZE": 6291456,
  71.                 "MAX_HEADER_LIST_SIZE": 262144,
  72.             },
  73.             h2_settings_order=[
  74.                 "HEADER_TABLE_SIZE",
  75.                 "MAX_CONCURRENT_STREAMS",
  76.                 "INITIAL_WINDOW_SIZE",
  77.                 "MAX_HEADER_LIST_SIZE",
  78.             ],
  79.             supported_signature_algorithms=[
  80.                 "ECDSAWithP256AndSHA256",
  81.                 "PSSWithSHA256",
  82.                 "PKCS1WithSHA256",
  83.                 "ECDSAWithP384AndSHA384",
  84.                 "PSSWithSHA384",
  85.                 "PKCS1WithSHA384",
  86.                 "PSSWithSHA512",
  87.                 "PKCS1WithSHA512",
  88.             ],
  89.             supported_versions=["GREASE", "1.3", "1.2"],
  90.             key_share_curves=["GREASE", "X25519"],
  91.             cert_compression_algo="brotli",
  92.             pseudo_header_order=[":method", ":authority", ":scheme", ":path"],
  93.             connection_flow=15663105,
  94.             header_order=["accept", "user-agent", "accept-encoding", "accept-language"],
  95.         )
  96.         self.failed = []
  97.         self.success = []
  98.         self.captcha = []
  99.         if config["proxyless"] == False:
  100.             self.client.proxies = self.proxy
  101.  
  102.     def getProxy(self):
  103.         try:
  104.             proxy = random.choice(open("data/proxies.txt", "r").read().splitlines())
  105.             return {"http": f"http://{proxy}", "https": f"http://{proxy}"}
  106.         except Exception as e:
  107.             pass
  108.  
  109.     def getCookies(self, session=None):
  110.         headers = {
  111.             "accept": "*/*",
  112.             "accept-language": "en-US,en;q=0.5",
  113.             "connection": "keep-alive",
  114.             "host": "canary.discord.com",
  115.             "referer": "https://canary.discord.com/",
  116.             "sec-fetch-dest": "empty",
  117.             "sec-fetch-mode": "cors",
  118.             "sec-fetch-site": "same-origin",
  119.             "user-agent": "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; de-de) AppleWebKit/85.8.5 (KHTML, like Gecko) Safari/85",
  120.             "x-context-properties": "eyJsb2NhdGlvbiI6IkFjY2VwdCBJbnZpdGUgUGFnZSJ9",
  121.             "x-debug-options": "bugReporterEnabled",
  122.             "x-discord-locale": "en-US",
  123.             "x-super-properties": "eyJvcyI6Ik1hYyBPUyBYIiwiYnJvd3NlciI6IlNhZmFyaSIsImRldmljZSI6IiIsInN5c3RlbV9sb2NhbGUiOiJlbi1KTSIsImJyb3dzZXJfdXNlcl9hZ2VudCI6Ik1vemlsbGEvNS4wIChNYWNpbnRvc2g7IFU7IFBQQyBNYWMgT1MgWDsgZGUtZGUpIEFwcGxlV2ViS2l0Lzg1LjguNSAoS0hUTUwsIGxpa2UgR2Vja28pIFNhZmFyaS84NSIsImJyb3dzZXJfdmVyc2lvbiI6IiIsIm9zX3ZlcnNpb24iOiIiLCJyZWZlcnJlciI6IiIsInJlZmVycmluZ19kb21haW4iOiIiLCJyZWZlcnJlcl9jdXJyZW50IjoiIiwicmVmZXJyaW5nX2RvbWFpbl9jdXJyZW50IjoiIiwicmVsZWFzZV9jaGFubmVsIjoic3RhYmxlIiwiY2xpZW50X2J1aWxkX251bWJlciI6MTgxODMyLCJjbGllbnRfZXZlbnRfc291cmNlIjoibnVsbCJ9",
  124.         }
  125.         response = httpx.get(
  126.             "https://canary.discord.com/api/v9/experiments", headers=headers
  127.         )
  128.         self.dcfduid = response.cookies.get("__dcfduid")
  129.         self.sdcfduid = response.cookies.get("__sdcfduid")
  130.         self.cfruid = response.cookies.get("__cfruid")
  131.  
  132.     def boost(self, token, invite, guild):
  133.         headers = {
  134.             "authority": "discord.com",
  135.             "accept": "*/*",
  136.             "accept-language": "fr-FR,fr;q=0.9",
  137.             "authorization": token,
  138.             "cache-control": "no-cache",
  139.             "content-type": "application/json",
  140.             "cookie": f"__dcfduid={self.dcfduid}; __sdcfduid={self.sdcfduid}; __cfruid={self.cfruid}; locale=en-US",
  141.             "origin": "https://discord.com",
  142.             "pragma": "no-cache",
  143.             "referer": "https://discord.com/channels/@me",
  144.             "sec-ch-ua": '"Google Chrome";v="107", "Chromium";v="107", "Not=A?Brand";v="24"',
  145.             "sec-ch-ua-mobile": "?0",
  146.             "sec-ch-ua-platform": '"Windows"',
  147.             "sec-fetch-dest": "empty",
  148.             "sec-fetch-mode": "cors",
  149.             "sec-fetch-site": "same-origin",
  150.             "user-agent": "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; de-de) AppleWebKit/85.8.5 (KHTML, like Gecko) Safari/85",
  151.             "x-debug-options": "bugReporterEnabled",
  152.             "x-discord-locale": "en-US",
  153.             "x-super-properties": "eyJvcyI6Ik1hYyBPUyBYIiwiYnJvd3NlciI6IlNhZmFyaSIsImRldmljZSI6IiIsInN5c3RlbV9sb2NhbGUiOiJlbi1KTSIsImJyb3dzZXJfdXNlcl9hZ2VudCI6Ik1vemlsbGEvNS4wIChNYWNpbnRvc2g7IFU7IFBQQyBNYWMgT1MgWDsgZGUtZGUpIEFwcGxlV2ViS2l0Lzg1LjguNSAoS0hUTUwsIGxpa2UgR2Vja28pIFNhZmFyaS84NSIsImJyb3dzZXJfdmVyc2lvbiI6IiIsIm9zX3ZlcnNpb24iOiIiLCJyZWZlcnJlciI6IiIsInJlZmVycmluZ19kb21haW4iOiIiLCJyZWZlcnJlcl9jdXJyZW50IjoiIiwicmVmZXJyaW5nX2RvbWFpbl9jdXJyZW50IjoiIiwicmVsZWFzZV9jaGFubmVsIjoic3RhYmxlIiwiY2xpZW50X2J1aWxkX251bWJlciI6MTgxODMyLCJjbGllbnRfZXZlbnRfc291cmNlIjoibnVsbCJ9",
  154.         }
  155.  
  156.         slots = httpx.get(
  157.             "https://discord.com/api/v9/users/@me/guilds/premium/subscription-slots",
  158.             headers=headers,
  159.         )
  160.  
  161.         slot_json = slots.json()
  162.  
  163.         if slots.status_code == 401:
  164.             self.failed.append(token)
  165.             return
  166.  
  167.         if slots.status_code != 200 or len(slot_json) == 0:
  168.             return
  169.  
  170.         r = self.client.post(
  171.             f"https://discord.com/api/v9/invites/{invite}", headers=headers, json={}
  172.         )
  173.  
  174.         if r.status_code == 200:
  175.             boostsList = []
  176.             for boost in slot_json:
  177.                 boostsList.append(boost["id"])
  178.  
  179.             payload = {"user_premium_guild_subscription_slot_ids": boostsList}
  180.  
  181.             headers["method"] = "PUT"
  182.             headers["path"] = f"/api/v9/guilds/{guild}/premium/subscriptions"
  183.  
  184.             boosted = self.client.put(
  185.                 f"https://discord.com/api/v9/guilds/{guild}/premium/subscriptions",
  186.                 json=payload,
  187.                 headers=headers,
  188.             )
  189.  
  190.             if boosted.status_code == 201:
  191.                 self.success.append(token)
  192.                 return True
  193.             else:
  194.                 self.failed.append(token)
  195.  
  196.         elif r.status_code == 400:
  197.             self.failed.append(token)
  198.  
  199.         elif r.status_code != 200:
  200.             print(r.json())
  201.  
  202.     def nick(self, token, guild, nick):
  203.         headers = {
  204.             "authority": "discord.com",
  205.             "accept": "*/*",
  206.             "accept-language": "fr-FR,fr;q=0.9",
  207.             "authorization": token,
  208.             "cache-control": "no-cache",
  209.             "content-type": "application/json",
  210.             "cookie": f"__dcfduid={self.dcfduid}; __sdcfduid={self.sdcfduid}; __cfruid={self.cfruid}; locale=en-US",
  211.             "origin": "https://discord.com",
  212.             "pragma": "no-cache",
  213.             "referer": "https://discord.com/channels/@me",
  214.             "sec-ch-ua": '"Google Chrome";v="107", "Chromium";v="107", "Not=A?Brand";v="24"',
  215.             "sec-ch-ua-mobile": "?0",
  216.             "sec-ch-ua-platform": '"Windows"',
  217.             "sec-fetch-dest": "empty",
  218.             "sec-fetch-mode": "cors",
  219.             "sec-fetch-site": "same-origin",
  220.             "user-agent": "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; de-de) AppleWebKit/85.8.5 (KHTML, like Gecko) Safari/85",
  221.             "x-debug-options": "bugReporterEnabled",
  222.             "x-discord-locale": "en-US",
  223.             "x-super-properties": "eyJvcyI6Ik1hYyBPUyBYIiwiYnJvd3NlciI6IlNhZmFyaSIsImRldmljZSI6IiIsInN5c3RlbV9sb2NhbGUiOiJlbi1KTSIsImJyb3dzZXJfdXNlcl9hZ2VudCI6Ik1vemlsbGEvNS4wIChNYWNpbnRvc2g7IFU7IFBQQyBNYWMgT1MgWDsgZGUtZGUpIEFwcGxlV2ViS2l0Lzg1LjguNSAoS0hUTUwsIGxpa2UgR2Vja28pIFNhZmFyaS84NSIsImJyb3dzZXJfdmVyc2lvbiI6IiIsIm9zX3ZlcnNpb24iOiIiLCJyZWZlcnJlciI6IiIsInJlZmVycmluZ19kb21haW4iOiIiLCJyZWZlcnJlcl9jdXJyZW50IjoiIiwicmVmZXJyaW5nX2RvbWFpbl9jdXJyZW50IjoiIiwicmVsZWFzZV9jaGFubmVsIjoic3RhYmxlIiwiY2xpZW50X2J1aWxkX251bWJlciI6MTgxODMyLCJjbGllbnRfZXZlbnRfc291cmNlIjoibnVsbCJ9",
  224.         }
  225.  
  226.         payload = {"nick": nick}
  227.  
  228.         httpx.patch(
  229.             f"https://discord.com/api/v9/guilds/{guild}/members/@me",
  230.             headers=headers,
  231.             json=payload,
  232.         )
  233.  
  234.         httpx.patch(
  235.             f"https://discord.com/api/v9/users/@me/profile",
  236.             headers=headers,
  237.             json={"bio": nick},
  238.         )
  239.  
  240.     def nickThread(self, tokens, guild, nick):
  241.         """"""
  242.         threads = []
  243.  
  244.         for i in range(len(tokens)):
  245.             token = tokens[i]
  246.             t = threading.Thread(target=self.nick, args=(token, guild, nick))
  247.             t.daemon = True
  248.             threads.append(t)
  249.  
  250.         for i in range(len(tokens)):
  251.             threads[i].start()
  252.  
  253.         for i in range(len(tokens)):
  254.             threads[i].join()
  255.  
  256.         return True
  257.  
  258.     def thread(self, invite, tokens, guild):
  259.         """"""
  260.         threads = []
  261.  
  262.         for i in range(len(tokens)):
  263.             token = tokens[i]
  264.             t = threading.Thread(target=self.boost, args=(token, invite, guild))
  265.             t.daemon = True
  266.             threads.append(t)
  267.  
  268.         for i in range(len(tokens)):
  269.             threads[i].start()
  270.  
  271.         for i in range(len(tokens)):
  272.             threads[i].join()
  273.  
  274.         return {
  275.             "success": self.success,
  276.             "failed": self.failed,
  277.             "captcha": self.captcha,
  278.         }
  279.  
  280.  
  281.  
  282. bot = discord.Bot(intents=discord.Intents.all())
  283.  
  284.  
  285. def getStock(filename: str):
  286.     tokens = []
  287.     for i in open(filename, "r").read().splitlines():
  288.         if ":" in i:
  289.             i = i.split(":")[2]
  290.             tokens.append(i)
  291.         else:
  292.             tokens.append(i)
  293.     return tokens
  294.  
  295.  
  296. def getinviteCode(inv):
  297.     if "discord.gg" not in inv:
  298.         return inv
  299.     if "discord.gg" in inv:
  300.         invite = inv.split("discord.gg/")[1]
  301.         return invite
  302.     if "https://discord.gg" in inv:
  303.         invite = inv.split("https://discord.gg/")[1]
  304.         return invite
  305.  
  306.  
  307. def checkInvite(invite: str):
  308.     data = httpx.get(
  309.         f"https://discord.com/api/v9/invites/{invite}?inputValue={invite}&with_counts=true&with_expiration=true"
  310.     ).json()
  311.  
  312.     if data["code"] == 10006:
  313.         return False
  314.     elif data:
  315.         return data["guild"]["id"]
  316.     else:
  317.         return False
  318.  
  319.  
  320. @bot.event
  321. async def on_ready():
  322.     await bot.change_presence(status=discord.Status.dnd, activity=discord.Activity(type=discord.ActivityType.listening, name='Best Boost Bot'))
  323.     print(f"{Fore.BLUE} [BOT]: {bot.user} is online.{Fore.RESET}")
  324.  
  325.  
  326. @bot.slash_command(
  327.     guild_ids=config["dev-guilds"], name="boost", description="Boost a server by using that command."
  328. )
  329. async def boost(
  330.     ctx,
  331.     invite: discord.Option(str, "Invite code of the server.", required=True),
  332.     amount: discord.Option(
  333.         int, "Amount of boosts (must be in numbers).", required=True
  334.     ),
  335.     months: discord.Option(int, "Number of months (1/3).", required=True),
  336.     nick: discord.Option(str, "Nickname and bio.", required=True),
  337. ):
  338.     await ctx.response.defer(ephemeral=False)
  339.  
  340.     if str(ctx.author.id) not in config["owners"]:
  341.         return await ctx.respond(
  342.             embed=discord.Embed(
  343.                 title="**ERROR**",
  344.                 description="Missing permissions, you cannot use this command.",
  345.                 color=0xC80000,
  346.             )
  347.         )
  348.  
  349.     if amount % 2 != 0:
  350.         return await ctx.respond(
  351.             embed=discord.Embed(
  352.                 title="**ERROR**",
  353.                 description="Number of boosts should be in numbers.",
  354.                 color=0xC80000,
  355.             )
  356.         )
  357.  
  358.     if months != 1 and months != 3:
  359.         return await ctx.respond(
  360.             embed=discord.Embed(
  361.                 title="**ERROR**",
  362.                 description="Invalid months [VALID INPUTS: 1/3].",
  363.                 color=0xC80000,
  364.             )
  365.         )
  366.  
  367.     inviteCode = getinviteCode(invite)
  368.     inviteData = checkInvite(inviteCode)
  369.  
  370.     if inviteData == False:
  371.         return await ctx.respond(
  372.             embed=discord.Embed(
  373.                 title="**ERROR**",
  374.                 description="Invalid invite provided.",
  375.                 color=0xC80000,
  376.             )
  377.         )
  378.  
  379.     if months == 1:
  380.         filename = "data/1m.txt"
  381.     if months == 3:
  382.         filename = "data/3m.txt"
  383.  
  384.     tokensStock = getStock(filename)
  385.     requiredStock = int(amount / 2)
  386.  
  387.     if requiredStock > len(tokensStock):
  388.         return await ctx.respond(
  389.             embed=discord.Embed(
  390.                 title="**ERROR**",
  391.                 description=f"We don't have enough tokens in stock\nUse `/restock` command to restock.",
  392.                 color=0xC80000,
  393.             )
  394.         )
  395.  
  396.     boost = Booster()
  397.  
  398.     tokens = []
  399.  
  400.     for x in range(requiredStock):
  401.         tokens.append(tokensStock[x])
  402.         remove(tokensStock[x], filename)
  403.  
  404.     await ctx.respond(
  405.         embed=discord.Embed(
  406.             title="Boost Bot", description=f"Boosting....", color=0x5598D2
  407.         )
  408.     )
  409.  
  410.     start = time.time()
  411.     status = boost.thread(inviteCode, tokens, inviteData)
  412.  
  413.     time_taken = round(time.time() - start, 2)
  414.  
  415.     await ctx.edit(
  416.         embed=discord.Embed(
  417.             title="**Boosts Successful**",
  418.             description=f"**__Amount__ ->**  {amount} boosts \n**__Months__ ->** {months}m \n**__Server Link__ ->** .gg/{inviteCode} \n**__Tokens used__ ->** {requiredStock} \n**__Successfull tokens__ ->** {len(status['success'])} \n**__Failed tokens__ ->** {len(status['failed'])}\n**__Captcha tokens__ ->** {len(status['captcha'])} \n**__Time taken__ ->** {time_taken}s",
  419.             color=0x5598D2,
  420.         )
  421.     )
  422.  
  423.     boost.nickThread(tokens, inviteData, nick)
  424.  
  425.     return True
  426.  
  427.  
  428. @bot.slash_command(
  429.     guild_ids=config["dev-guilds"], name="addadmin", description="Add an admin to use the bot command."
  430. )
  431. async def addadmin(
  432.     ctx,
  433.     member: discord.Option(discord.Member, "The member you want to add.", required=True),
  434. ):
  435.     await ctx.defer(ephemeral=False)
  436.     if str(ctx.author.id) not in config["owners"]:
  437.         return await ctx.respond(
  438.             embed=discord.Embed(
  439.                 title="**ERROR**",
  440.                 description="You cannot use this command.",
  441.                 color=0xC80000,
  442.             )
  443.         )
  444.  
  445.     config["admins"].append(str(member.id))
  446.     with open("config.json", "w") as f:
  447.         json.dump(config, f, indent=4)
  448.  
  449.     return await ctx.edit(
  450.         embed=discord.Embed(
  451.             title="Boost Bot",
  452.             description=f"Added the member to admin successfully.",
  453.             color=0x5598D2,
  454.         )
  455.     )
  456.  
  457.  
  458. def remove(token: str, filename: str):
  459.     tokens = getStock(filename)
  460.     tokens.pop(tokens.index(token))
  461.     f = open(filename, "w")
  462.  
  463.     for x in tokens:
  464.         f.write(f"{x}\n")
  465.  
  466.     f.close()
  467.  
  468.  
  469. @bot.slash_command(
  470.     guild_ids=config["dev-guilds"], name="sendtokens", description="Sends the tokens to the user."
  471. )
  472. async def sendtokens(
  473.     ctx,
  474.     member: discord.Option(discord.Member, "The member you want to send.", required=True),
  475.     amount: discord.Option(int, "Amount of tokens to send.", required=True),
  476.     months: discord.Option(int, "Number of months (1/3).", required=True),
  477. ):
  478.     await ctx.defer(ephemeral=False)
  479.  
  480.     if str(ctx.author.id) not in config["owners"]:
  481.         return await ctx.respond(
  482.             embed=discord.Embed(
  483.                 title="**ERROR**",
  484.                 description="Missing permissions, you cannot use this command.",
  485.                 color=0xC80000,
  486.             )
  487.         )
  488.  
  489.     if months != 1 and months != 3:
  490.         return await ctx.respond(
  491.             embed=discord.Embed(
  492.                 title="**ERROR**",
  493.                 description="Invalid months [VALID INPUTS: 1/3].",
  494.                 color=0xC80000,
  495.             )
  496.         )
  497.  
  498.     if months == 1:
  499.         filename = "data/1m.txt"
  500.     if months == 3:
  501.         filename = "data/3m.txt"
  502.  
  503.     tokensStock = getStock(filename)
  504.  
  505.     if amount > len(tokensStock):
  506.         return await ctx.respond(
  507.             embed=discord.Embed(
  508.                 title="**ERROR**",
  509.                 description=f"We don't have enough tokens in stock\nUse `/restock` command to restock.",
  510.                 color=0xC80000,
  511.             )
  512.         )
  513.  
  514.     tokens = []
  515.     for x in range(amount):
  516.         tokens.append(tokensStock[x])
  517.         remove(tokensStock[x], filename)
  518.  
  519.     stuff = "\n".join(tokens)
  520.  
  521.     with open("result.txt", "w") as file:
  522.         file.write(stuff.format("\n", "\n"))
  523.  
  524.     with open("result.txt", mode="rb") as f:
  525.         await member.send(
  526.             embed=discord.Embed(
  527.                 title="Boost Bot",
  528.                 description=f"Thanks for using our services.",
  529.                 color=0x5598D2,
  530.             ),
  531.             file=discord.File(f),
  532.         )
  533.  
  534.     return await ctx.edit(
  535.         embed=discord.Embed(
  536.             title="Boost Bot",
  537.             description=f"Sent {amount}x tokens.",
  538.             color=0x5598D2,
  539.         )
  540.     )
  541.  
  542.  
  543. @bot.slash_command(
  544.     guild_ids=config["dev-guilds"], name="website", description="It will send a website link."
  545. )
  546. async def website(
  547.     ctx,
  548. ):
  549.     return await ctx.respond(
  550.         embed=discord.Embed(
  551.             title="Website",
  552.             description=f"Website: {config['website']}",
  553.             color=0x5598D2,
  554.         )
  555.     )
  556.  
  557.  
  558. @bot.slash_command(guild_ids=config["dev-guilds"], name="pp", description="It will send the paypal.")
  559. async def pp(
  560.     ctx,
  561. ):
  562.     return await ctx.respond(
  563.         embed=discord.Embed(
  564.             title="Paypal",
  565.             description=f"PayPal: {config['pp']}",
  566.             color=0x5598D2,
  567.         )
  568.     )
  569.  
  570.  
  571. @bot.slash_command(guild_ids=config["dev-guilds"], name="ltc", description="It will send the litecoin address.")
  572. async def ltc(
  573.     ctx,
  574. ):
  575.     return await ctx.respond(
  576.         embed=discord.Embed(
  577.             title="Litecoin",
  578.             description=f"Litecoin: {config['ltc']}",
  579.             color=0x5598D2,
  580.         )
  581.     )
  582.  
  583.  
  584. @bot.slash_command(guild_ids=config["dev-guilds"], name="btc", description="It will send the bitcoin address.")
  585. async def btc(
  586.     ctx,
  587. ):
  588.     return await ctx.respond(
  589.         embed=discord.Embed(
  590.             title="Bitcoin",
  591.             description=f"Bitcoin: {config['bitcoin']}",
  592.             color=0x5598D2,
  593.         )
  594.     )
  595.  
  596. class MyView(discord.ui.View):
  597.     @discord.ui.button(label="", row=1, style=discord.ButtonStyle.grey, emoji='💰')
  598.     async def first_button_callback(self, button, interaction):
  599.         await interaction.response.send_message(embed=discord.Embed(
  600.             title="__Boost Commands__",
  601.             description="**/boost | /restock | /stock | /sendtokens**",
  602.             color=0x5598D2,
  603.         ))
  604.     @discord.ui.button(label="", row=1, style=discord.ButtonStyle.grey, emoji="🍸")
  605.     async def second_button_callback(self, button, interaction):
  606.         await interaction.response.send_message(embed=discord.Embed(
  607.             title='__Others Commands__',
  608.             description='**/pp | /btc | /ltc | /ca | /website**',
  609.             color=0x5598D2,
  610.         ))
  611.     @discord.ui.button(label="", row=1, style=discord.ButtonStyle.grey, emoji="🌟")
  612.     async def third_button_callback(self, button, interaction):
  613.         await interaction.response.send_message(embed=discord.Embed(
  614.             title='__Owner Commands__',
  615.             description='**/addadmin | /addowner**',
  616.             color=0x5598D2,
  617.         ))
  618.  
  619. @bot.slash_command(guild_ids=config["dev-guilds"], name="help", description="It will show the help menu.")
  620. async def help(ctx):
  621.     await ctx.respond(
  622.         embed=discord.Embed(
  623.             title="Help Menu",
  624.             description="**It will show the bot all commands!**",
  625.             color=0x5598D2
  626.             ),
  627.             view=MyView()
  628.     )
  629.  
  630.  
  631. @bot.slash_command(guild_ids=config["dev-guilds"], name="ca", description="It will send the cashapp.")
  632. async def ca(
  633.     ctx,
  634. ):
  635.     return await ctx.respond(
  636.         embed=discord.Embed(
  637.             title="Cashapp",
  638.             description=f"CashApp: {config['cashapp']}",
  639.             color=0x5598D2,
  640.         )
  641.     )
  642.  
  643.  
  644. @bot.slash_command(
  645.     guild_ids=config["dev-guilds"], name="addowner", description="Add a member as a owner."
  646. )
  647. async def addowner(
  648.     ctx,
  649.     member: discord.Option(discord.Member, "The member you want to add.", required=True),
  650. ):
  651.     await ctx.defer(ephemeral=False)
  652.     if str(ctx.author.id) not in config["owners"]:
  653.         return await ctx.respond(
  654.             embed=discord.Embed(
  655.                 title="**ERROR**",
  656.                 description="You cannot use this command.",
  657.                 color=0xC80000,
  658.             )
  659.         )
  660.  
  661.     config["owners"].append(str(member.id))
  662.     with open("config.json", "w") as f:
  663.         json.dump(config, f, indent=4)
  664.  
  665.     return await ctx.edit(
  666.         embed=discord.Embed(
  667.             title="Boost Bot",
  668.             description=f"Added owner successfully",
  669.             color=0x5598D2,
  670.         )
  671.     )
  672.  
  673.  
  674. @bot.slash_command(
  675.     guild_ids=config["dev-guilds"], name="stock", description="Display the stock of boosts and tokens."
  676. )
  677. async def stock(
  678.     ctx,
  679.     type: discord.Option(int, "Number of months (1/3).", required=True),
  680. ):
  681.     await ctx.defer(ephemeral=False)
  682.  
  683.     if type != 1 and type != 3 and type != 0:
  684.         return await ctx.respond(
  685.             embed=discord.Embed(
  686.                 title="**ERROR**",
  687.                 description="Invalid type. [1/3] are valid inputs.",
  688.                 color=0xC80000,
  689.             )
  690.         )
  691.  
  692.     if type == 1:
  693.         fileName = "data/1m.txt"
  694.     elif type == 3:
  695.         fileName = "data/3m.txt"
  696.  
  697.     stock = len(open(fileName, "r").readlines())
  698.  
  699.     return await ctx.edit(
  700.         embed=discord.Embed(
  701.             title=f"**__{type} months tokens__**",
  702.             description=f"\n -> ``We have`` **{stock}** ``tokens and`` **{stock * 2}** ``boosts in stock``",
  703.             color=0x5598D2,
  704.         )
  705.     )
  706.  
  707.  
  708. @bot.slash_command(
  709.     guild_ids=config["dev-guilds"], name="restock", description="Add the tokens in the stock."
  710. )
  711. async def restock(
  712.     ctx,
  713.     type: discord.Option(int, "Number of months (1/3).", required=True),
  714.     file: discord.Option(discord.Attachment, "Attachment", required=True),
  715. ):
  716.     await ctx.defer(ephemeral=False)
  717.  
  718.     if (
  719.         str(ctx.author.id) not in config["owners"]
  720.         and str(ctx.author.id) not in config["admins"]
  721.     ):
  722.         return await ctx.respond(
  723.             embed=discord.Embed(
  724.                 title="**ERROR**",
  725.                 description="Missing permissions, you cannot use this command.",
  726.                 color=0xC80000,
  727.             )
  728.         )
  729.  
  730.     if type != 1 and type != 3 and type != 0:
  731.         return await ctx.respond(
  732.             embed=discord.Embed(
  733.                 title="**ERROR**",
  734.                 description="Invalid type. [1/3] are valid inputs.",
  735.                 color=0xC80000,
  736.             )
  737.         )
  738.  
  739.     if type == 1:
  740.         fileName = "data/1m.txt"
  741.     elif type == 3:
  742.         fileName = "data/3m.txt"
  743.  
  744.     content = await file.read()
  745.  
  746.     stuff = content.decode().split("\r\n")
  747.     before = getStock(fileName)
  748.  
  749.     for x in range(len(before)):
  750.         stuff.append(before[x])
  751.  
  752.     cute = "\n".join(stuff)
  753.     text = cute.replace("b'", "").replace("'", "")
  754.  
  755.     print(text)
  756.  
  757.     with open(fileName, "w") as file:
  758.         file.write(text + "\n")
  759.  
  760.     return await ctx.edit(
  761.         embed=discord.Embed(
  762.             title="Boost Bot",
  763.             description=f"Restocked successfully",
  764.             color=0x5598D2,
  765.         )
  766.     )
  767.  
  768.  
  769. orders_sellapp = []
  770. orders_sellix = []
  771.  
  772.  
  773. @app.route("/sellix", methods=["POST"])
  774. def sellix():
  775.     data = request.json
  776.     if data in orders_sellix:
  777.         pass
  778.     elif data not in orders_sellix:
  779.         threading.Thread(
  780.             target=sellixshit,
  781.             args=[
  782.                 data,
  783.             ],
  784.         ).start()
  785.         orders_sellix.append(data)
  786.     return jsonify({"message": f"We've recieved your order"}), 200
  787.  
  788.  
  789. def sellixshit(data):
  790.     """"""
  791.     invite = ""
  792.     title = data["data"]["product_title"].lower()
  793.  
  794.     split_parts = title.split(" | ")
  795.  
  796.     amount = int(split_parts[0].split()[0])
  797.     months = int(split_parts[1].split()[0])
  798.  
  799.     if amount == None or months == None:
  800.         return
  801.  
  802.     for i in data["data"]["custom_fields"]:
  803.         if i == config["sellix"]["invite_field_name"]:
  804.             invite = data["data"]["custom_fields"][i]
  805.  
  806.     order_id = data["data"]["uniqid"]
  807.     email = data["data"]["customer_email"]
  808.     product = data["data"]["product_title"]
  809.  
  810.     inviteCode = getinviteCode(invite)
  811.     inviteData = checkInvite(inviteCode)
  812.  
  813.     embeds_data = {
  814.         "embeds": [
  815.             {
  816.                 "title": "**Sellix Order**",
  817.                 "description": f"**Order ID: **{order_id}\n**Email: **{email}\n**Product: **{product}\n**Amount: **{amount} Boosts\n**Months: **{months} Months\n**Invite: **[{inviteCode}](https://discord.gg/{inviteCode})",
  818.             }
  819.         ]
  820.     }
  821.  
  822.     response = httpx.post(
  823.         config["sellix"]["orders"],
  824.         data=json.dumps(embeds_data),
  825.         headers={"Content-Type": "application/json"},
  826.     )
  827.  
  828.     if response.status_code == 204:
  829.         """"""
  830.     else:
  831.         print(response.json())
  832.  
  833.     if inviteData == False:
  834.         return print(f"[ERROR]: Invalid invite was provided for order: {order_id}")
  835.  
  836.     if months == 1:
  837.         filename = "data/1m.txt"
  838.     if months == 3:
  839.         filename = "data/3m.txt"
  840.  
  841.     tokensStock = getStock(filename)
  842.     requiredStock = int(amount / 2)
  843.  
  844.     if requiredStock > len(tokensStock):
  845.         return print(
  846.             f"[ERROR]: We didn't had enough boosts to satisfy order: {order_id}"
  847.         )
  848.  
  849.     tokens = []
  850.  
  851.     for x in range(requiredStock):
  852.         tokens.append(tokensStock[x])
  853.         remove(tokensStock[x], filename)
  854.  
  855.     cool = Booster()
  856.     status = cool.thread(inviteCode, tokens, inviteData)
  857.     success = status["success"]
  858.     failed = status["failed"]
  859.  
  860.     print(
  861.         f"{Fore.GREEN}[+]: Attempted to do {Fore.BLUE}{amount}x{Fore.RESET} {Fore.GREEN}boosts for {order_id} order id. {Fore.RESET} {Fore.CYAN}\n[-]: Successfully did {Fore.RESET}{len(success)}x boost. {Fore.CYAN}\n[-]: Failed to do {Fore.RESET}{len(failed)}x boosts.\n\n    Results \n[Success]: {success}\n[Failed]: {failed} \n\n"
  862.     )
  863.  
  864.     completed_data = {
  865.         "embeds": [
  866.             {
  867.                 "title": "**Sellix Completion**",
  868.                 "description": f"**Order ID: **{order_id}\n**Email: **{email}\n**Product: **{product}\n**Amount: **{amount} Boosts\n**Months: **{months} Months\n**Invite: **[{inviteCode}](https://discord.gg/{inviteCode}) \n\n**[SUCCESS]**: {success} \n**[FAILED]**: {failed}",
  869.             }
  870.         ]
  871.     }
  872.  
  873.     response = httpx.post(
  874.         config["sellapp"]["orders"],
  875.         data=json.dumps(completed_data),
  876.         headers={"Content-Type": "application/json"},
  877.     )
  878.  
  879.     if response.status_code == 204:
  880.         """"""
  881.     else:
  882.         print(response.json())
  883.  
  884.  
  885. @app.route("/sellapp", methods=["POST"])
  886. def sellapp():
  887.     data = request.json
  888.     order_id = data["invoice"]["id"]
  889.  
  890.     if order_id in orders_sellapp:
  891.         pass
  892.     elif order_id not in orders_sellapp:
  893.         threading.Thread(
  894.             target=sellshit,
  895.             args=[
  896.                 data,
  897.             ],
  898.         ).start()
  899.         orders_sellapp.append(order_id)
  900.     return jsonify({"message": f"We've recieved your order"}), 200
  901.  
  902.  
  903. def sellshit(data):
  904.     """"""
  905.     invite = ""
  906.  
  907.     for i in data["additional_information"]:
  908.         if i["label"] == config["sellapp"]["invite_field_name"]:
  909.             invite = i["value"]
  910.  
  911.     title = data["listing"]["title"]
  912.  
  913.     split_parts = title.split(" | ")
  914.  
  915.     amount = int(split_parts[0].split()[0])
  916.     months = int(split_parts[1].split()[0])
  917.  
  918.     if amount == None or months == None:
  919.         return
  920.  
  921.     inviteCode = getinviteCode(invite)
  922.     inviteData = checkInvite(inviteCode)
  923.  
  924.     order_id = data["invoice"]["id"]
  925.     email = data["invoice"]["payment"]["gateway"]["data"]["customer_email"]
  926.     product = data["listing"]["title"]
  927.  
  928.     embeds_data = {
  929.         "embeds": [
  930.             {
  931.                 "title": "**SellApp Order**",
  932.                 "description": f"**Order ID: **{order_id}\n**Email: **{email}\n**Product: **{product}\n**Amount: **{amount} Boosts\n**Months: **{months} Months\n**Invite: **[{inviteCode}](https://discord.gg/{inviteCode})",
  933.             }
  934.         ]
  935.     }
  936.  
  937.     response = httpx.post(
  938.         config["sellapp"]["orders"],
  939.         data=json.dumps(embeds_data),
  940.         headers={"Content-Type": "application/json"},
  941.     )
  942.  
  943.     if response.status_code == 204:
  944.         """"""
  945.     else:
  946.         print(response.json())
  947.  
  948.     if inviteData == False:
  949.         return print(f"[ERROR]: Invalid invite was provided for order: {order_id}")
  950.  
  951.     if months == 1:
  952.         filename = "data/1m.txt"
  953.     if months == 3:
  954.         filename = "data/3m.txt"
  955.  
  956.     tokensStock = getStock(filename)
  957.     requiredStock = int(amount / 2)
  958.  
  959.     if requiredStock > len(tokensStock):
  960.         return print(
  961.             f"[ERROR]: We didn't had enough boosts to satisfy order: {order_id}"
  962.         )
  963.  
  964.     tokens = []
  965.  
  966.     for x in range(requiredStock):
  967.         tokens.append(tokensStock[x])
  968.         remove(tokensStock[x], filename)
  969.  
  970.     cool = Booster()
  971.     status = cool.thread(inviteCode, tokens, inviteData)
  972.     success = status["success"]
  973.     failed = status["failed"]
  974.  
  975.     print(
  976.         f"{Fore.GREEN}[+]: Attempted to do {Fore.BLUE}{amount}x{Fore.RESET} {Fore.GREEN}boosts for {order_id} order id. {Fore.RESET} {Fore.CYAN}\n[-]: Successfully did {Fore.RESET}{len(success)}x boost. {Fore.CYAN}\n[-]: Failed to do {Fore.RESET}{len(failed)}x boosts.\n\n    Results \n[Success]: {success}\n[Failed]: {failed} \n\n"
  977.     )
  978.  
  979.     completed_data = {
  980.         "embeds": [
  981.             {
  982.                 "title": "**SellApp Completion**",
  983.                 "description": f"**Order ID: **{order_id}\n**Email: **{email}\n**Product: **{product}\n**Amount: **{amount} Boosts\n**Months: **{months} Months\n**Invite: **[{inviteCode}](https://discord.gg/{inviteCode}) \n\n**[SUCCESS]**: {success} \n**[FAILED]**: {failed}",
  984.             }
  985.         ]
  986.     }
  987.  
  988.     response = httpx.post(
  989.         config["sellapp"]["orders"],
  990.         data=json.dumps(completed_data),
  991.         headers={"Content-Type": "application/json"},
  992.     )
  993.  
  994.     if response.status_code == 204:
  995.         """"""
  996.     else:
  997.         print(response.json())
  998.  
  999. def serve():
  1000.     app.run(host="0.0.0.0", port=config["port"])
  1001.  
  1002. def startServer():
  1003.     server = threading.Thread(target=serve)
  1004.     server.start()
  1005.  
  1006. startServer();
  1007. bot.run(config["token"])
Add Comment
Please, Sign In to add comment