-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
150 lines (105 loc) · 4.4 KB
/
main.py
File metadata and controls
150 lines (105 loc) · 4.4 KB
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
import discord
import os
from keep_alive import keep_alive
import string
import random
import requests
bot = discord.Client(activity=discord.Game(name="Nitro"))
comch = 899554220204781619
dropch = 899554241910280192
aemo = "<a:ani:886814282694668298>"
emo = "<:EWdeUeHXkAQgJh7:886492479577264148>"
@bot.event
async def on_ready():
print(bot.user)
@bot.event
async def on_message(message):
if message.author == bot.user:
return
if message.content == "!h":
he = discord.Embed(title = "Help", color=0xf47fff)
he.add_field(name="!g (nitro/nitro classic)", value="Generate 1 unchecked nitro/nitro classic code")
he.add_field(name="!gc (nitro/nitro classic)", value="Generate and check 1 nitro/nitro classic code")
he.add_field(name="!c (nitro code/nitro classic code)", value="Check a nitro/nitro classic code")
he.add_field(name="!pc (nitro code/nitro classic code)", value="Check a nitro/nitro classic code using a proxy to prevent ratelimiting")
he.add_field(name="!h", value="Help")
await message.channel.send(embed=he)
if message.content.startswith("!pc") and message.channel.id == comch:
await message.channel.send("This feature is in beta.")
if message.content.startswith("!g") and message.channel.id == comch:
ntype = message.content[3:]
ntype.strip()
ntype = ntype.lower()
if ntype == "nitro" or ntype == "nitro classic":
code = nitrounchecked(ntype)
await message.author.send("https://discord.gift/"+code)
await message.channel.send(message.author.mention+" Check your DMs for "+ntype+"!")
if message.content.startswith("!c") and message.channel.id == comch:
code = message.content[3:]
code.strip()
if len(code) == 16 or len(code) == 24:
url = "https://discordapp.com/api/v8/entitlements/gift-codes/" + code
response = requests.get(url)
if response.status_code == 200:
x = "Valid"
channel = bot.get_channel(dropch)
await channel.send("https://discord.gift/"+code)
elif response.status_code == 429:
x = "Ratelimited"
elif response.status_code == 404:
x = "Expired"
else:
x = "Invalid"
if len(code) == 16:
t = "Nitro Classic"
elif len(code) == 24:
t = "Nitro"
else:
t = "Invalid"
emb1 = discord.Embed(title = emo + " Discord Nitro " + emo, color=0xf47fff)
emb1.add_field(name="Code", value=code, inline=False)
emb1.add_field(name="Type", value=t, inline=True)
emb1.add_field(name="Status", value=x, inline=True)
await message.channel.send(embed=emb1)
if message.content.startswith("!gc") and message.channel.id == comch:
ntype = message.content[4:]
ntype.strip()
ntype = ntype.lower()
if ntype == "nitro" or ntype == "nitro classic":
code = nitrounchecked(ntype)
url = "https://discordapp.com/api/v8/entitlements/gift-codes/" + code
response = requests.get(url)
if response.status_code == 200:
x = "Valid"
channel = bot.get_channel(dropch)
await channel.send("https://discord.gift/"+code)
elif response.status_code == 429:
x = "Ratelimited"
elif response.status_code == 404:
x = "Expired"
else:
x = "Invalid"
if len(code) == 16:
t = "Nitro Classic"
elif len(code) == 24:
t = "Nitro"
emb = discord.Embed(title = aemo + " Discord Nitro " + aemo, color=0xf47fff)
emb.add_field(name="Code", value=code, inline=False)
emb.add_field(name="Type", value=t, inline=True)
emb.add_field(name="Status", value=x, inline=True)
await message.channel.send(message.author.mention+" Check your DMs for "+ntype+"!")
await message.author.send(embed=emb)
await message.author.send("https://discord.gift/"+code)
def nitrounchecked(type):
if type == "nitro classic":
length = 16
elif type == "nitro":
length = 24
code = list(string.ascii_letters + string.digits)
random.shuffle(code)
code = random.choices(code, k=length)
random.shuffle(code)
code = "".join(code)
return code
keep_alive()
bot.run(os.environ['Token'])