-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
317 lines (290 loc) · 9.09 KB
/
setup.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
import discord
import os
import requests
import json
import random
from time import sleep
from datetime import datetime
TOKEN_GHOST = os.environ['TOKEN']
TOKEN_STATS = os.environ['TOKEN1']
client = discord.Client()
client1 = discord.Client()
def get_quote():
response = requests.get("https://zenquotes.io/api/random")
json_data = json.loads(response.text)
quote = json_data[0]['q'] + " -" + json_data[0]['a']
return(quote)
@client.event
async def on_ready():
print('I am logged in as {0.user}'.format(client))
@client1.event
async def on_ready():
print('I am logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('.bpin'):
if message.author.guild_permissions.administrator:
await message.delete()
embed = discord.Embed(
title=message.guild.name,
color=discord.Color.gold(),
timestamp=datetime.utcnow()
)
embed.set_author(
name=message.author.display_name,
icon_url=message.author.avatar_url
)
embed.set_footer(
text=client.user.name,
icon_url=client.user.avatar_url
)
embed.add_field(
name="Our BOT's...",
value="Official bot <@&825930442627743755> ,Type `.help` for commands list.\nOur Play bot <@&861272759677091851> ,Type `pls help` for command list.\nOur rank bot for chatting <@&872883107005624341> ,Type `!help` for commands list",
inline=True
)
await message.channel.send(embed=embed)
else:
await message.channel.send(":no_entry: You don't have the permissions to do that")
#----hello command for everone----#
if message.content.startswith('.hello'):
await message.channel.send(f'Welcome to {message.guild.name} CODM Clan Discord Server :wink:')
#-----print all command-----#
if message.content.startswith('.help'):
helpembed = discord.Embed(
title = str("List of available commands"),
color = discord.Color.gold(),
timestamp = datetime.utcnow()
)
helpembed.set_author(
name = message.author.display_name,
icon_url=message.author.avatar_url
)
helpembed.set_footer(
text=client.user.name,
icon_url=client.user.avatar_url
)
helpembed.add_field(
name="General",
value="`.hello` -prints welcome message\n`.inspire` -show random quotes\n`.ping` -ping the bot\n`.name` -print the nameof bot\n`.roll` -roll the dice\n`.play` -play guess the number game",
inline=True
)
helpembed.add_field(
name="Admin",
value="`.say` -say something using bot",
inline=True
)
msg = await message.channel.send(embed=helpembed)
#await message.channel.send('You can communicate with me by typing\n .hello\n .inspire\n .ping \n .name \n .member \n .roll \n .play')
#-----print random quotes-----#
if message.content.startswith('.inspire'):
quote = get_quote()
embed = discord.Embed(
title=message.guild.name,
color=discord.Color.gold(),
timestamp=datetime.utcnow()
)
embed.set_author(
name=message.author.display_name,
icon_url=message.author.avatar_url
)
embed.set_footer(
text=client.user.name,
icon_url=client.user.avatar_url
)
embed.add_field(
name=".",
value=quote,
inline=False
)
await message.channel.send(embed=embed)
#await message.channel.send(quote)
#------simple guessing game----#
if message.content.startswith('.play'):
num = random.randint(1,10)
count= 3
for i in range (0, 4):
if i<=2:
await message.channel.send(f"Choose a number between 1-10\n you have {count} chances")
guess = await client.wait_for("message")
if int(guess.content) > num:
await message.channel.send("Your guess is too high")
elif int(guess.content) == num:
await message.channel.send("You guessed the correct number!")
break
elif int(guess.content) < num:
await message.channel.send("Your gess is too low")
count = count - 1
else:
await message.channel.send(f"You lost! The number was {num} your guess was {i}")
if i == 3:
break
#----ping the bot----#
if message.content.startswith('.ping'):
latency = client.latency
pingembed = discord.Embed(
title = message.guild.name,
color = discord.Color.gold(),
timestamp = datetime.utcnow()
)
pingembed.set_author(
name = message.author.display_name,
icon_url=message.author.avatar_url
)
pingembed.set_footer(
text=client.user.name,
icon_url=client.user.avatar_url
)
pingembed.add_field(
name="Latency",
value=f"Pong! `{round (latency*1000)}ms`",
inline=True
)
await message.channel.send(embed=pingembed)
#-----print boot name----#
if message.content.startswith('.name'):
await message.channel.send('My name is Ghost :robot:')
#-----roll dice -----
if message.content.startswith('.roll'):
rollembed = discord.Embed(
title = message.guild.name,
color = discord.Color.gold(),
timestamp = datetime.utcnow()
)
rollembed.set_author(
name = message.author.display_name,
icon_url=message.author.avatar_url
)
rollembed.set_footer(
text=client.user.name,
icon_url=client.user.avatar_url
)
rollembed.add_field(
name="Dice roll",
value="Rolling the dice...:game_die:",
inline=False
)
msg = await message.channel.send(embed=rollembed)
x = random.randint(1, 6)
time.sleep(2)
if x==1:
(y)=":one:"
elif x==2:
(y)=":two:"
elif x==3:
(y)=":three:"
elif x==4:
(y)=":four:"
elif x==5:
(y)=":five:"
else:
(y)=":six:"
embed = discord.Embed(
title=message.guild.name,
color=discord.Color.gold(),
timestamp=datetime.utcnow()
)
embed.set_author(
name=message.author.display_name,
icon_url=message.author.avatar_url
)
embed.set_footer(
text=client.user.name,
icon_url=client.user.avatar_url
)
embed.add_field(
name="Dice roll results",
value=f"{y}",
inline=True
)
await msg.edit(embed=embed)
#say somthing using bot
if message.content.startswith('.say'):
command = message.content.strip(".say").split(" ")
if message.author.guild_permissions.administrator:
await message.delete()
text = str(" ".join(command))
sayembed = discord.Embed(
title = message.guild.name,
color = discord.Color.gold(),
timestamp = datetime.utcnow()
)
sayembed.set_author(
name = message.author.display_name,
icon_url=message.author.avatar_url
)
sayembed.set_footer(
text=client.user.name,
icon_url=client.user.avatar_url
)
sayembed.add_field(
name="Bot says...",
value=text,
inline=False
)
await message.channel.send(embed=sayembed)
else:
await message.delete()
await message.channel.send(
":no_entry: You dont't have the permission to do that!")
await message.delete()
if message.content.startswith('Pls rob'):
await message.channel.send('This command is disabled fools')
@client1.event
async def on_message(msg):
args = msg.content.split(" ")
cmd = args[0]
Channel = client.get_channel(919272383213367337)
if msg.author == client.user:
return
if cmd == "!clear":
await msg.channel.send(f'Clearing {args[1]} messages..')
sleep(2)
await msg.channel.purge(limit=int(args[1]))
if cmd == "!ip":
await msg.delete()
sleep(2)
embed = discord.Embed(
title=msg.guild.name,
color=discord.Color.gold(),
timestamp=datetime.utcnow()
)
embed.set_footer(
text=client.user.name,
icon_url=client.user.avatar_url
)
embed.add_field(
name='**@everyone**',
value="Creating new ngrok tunnel and requesting for IP pls wait....",
inline=True
)
await Channel.send(embed=embed)
await Channel.send("@everyone")
res = r.get(url)
await Channel.send("```" + res.text + "```")
if "Server has started" in msg.content:
embed = discord.Embed(
title=msg.guild.name,
color=discord.Color.gold(),
timestamp=datetime.utcnow()
)
embed.set_footer(
text=client.user.name,
icon_url=client.user.avatar_url
)
embed.add_field(
name='**@everyone**',
value="Creating new ngrok tunnel and requesting for IP pls wait....",
inline=True
)
await Channel.send(embed=embed)
await Channel.send("@everyone")
res = requests.get(url)
await Channel.send("```" + res.text + "```")
if "Server has stopped" in msg.content:
await Channel.send("Destroying Tunnel...")
await Channel.purge(limit=10)
client.run(TOKEN_GHOST)
client1.run(TOKEN_STATS)