forked from MiscGuild/discord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
4229 lines (3716 loc) · 242 KB
/
bot.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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import discord, json, random, math, requests
import hypixel
import time
import aiohttp
import asyncio
from quickchart import QuickChart
from discord.ext import commands
from datetime import datetime
from concurrent.futures import ThreadPoolExecutor
with open('config.json') as config_file:
configFile = json.load(config_file)
intents = discord.Intents.default()
intents.reactions = True
intents.members = True
client = commands.Bot(command_prefix=[',', '@Miscellaneous#4333'], intents=intents)
client.remove_command('help')
resident_req = int(50000)
active = int(275000)
inactive = int(100000)
dnkl = int(200000)
new_member = int(25000)
"-------------------------------------------------------------------------------------------------General--------------------------------------------------------------------------------------------------------------------"
@client.event
async def on_ready():
try:
statuses = ['with Miscellaneous members!', 'with cool kids of Miscellaneous!']
print('The Bot is up and running!')
for status in statuses:
await client.change_presence(status=discord.Status.idle, activity=discord.Game(status))
await asyncio.sleep(600)
with open('dnkl.json', 'r') as f:
data = str(f.read()).replace("'", '"')
with open('dnkl.json', 'w') as f:
f.write(data)
except Exception as e:
print(e)
client.loop.create_task(on_ready())
# Error Message
@client.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandNotFound):
embed = discord.Embed(title="Invalid Command!",
description=f"Use `help` for a list of all commands!",
color=0xff0000)
await ctx.send(embed=embed)
@client.event
async def on_member_join(member):
try:
channel = client.get_channel(714882620001091585)
role = discord.utils.get(member.guild.roles, name="New Member")
await member.add_roles(role)
embed = discord.Embed(title=f"Welcome to the Miscellaneous Discord, {member.name}", color=0x8368ff)
embed.add_field(name="Register using the following command:", value="**,register** `Your Minecraft Name`", inline=False)
embed.set_footer(text="Example:\n,register John")
await channel.send(embed=embed)
except Exception as e:
print(e)
@client.command(aliases=['req', 'requirement', 'Req', 'Requirement', 'Requirements'])
async def requirements(ctx):
try:
embed = discord.Embed(title="Miscellaneous Guild Requirements",
description="These requirements are subject to change!",
color=0x8368ff)
embed.add_field(name="Active", value=f"• {format(active,',d')} Weekly Guild Experience", inline=False)
embed.add_field(name="Do Not Kick List Eligibility", value=f"• {format(dnkl,',d')} Weekly Guild Experience", inline=False)
embed.add_field(name="Resident", value=f"• {format(resident_req,',d')} Weekly Guild Experience", inline=False)
embed.add_field(name="Member", value=f"• {format(inactive,',d')} Weekly Guild Experience", inline=False)
embed.add_field(name="New Member", value=f"• {format(new_member,',d')} Daily Guild Experience", inline=False)
embed.set_footer(text="You are considered a New Member for the first 7 days after joining the guild"
"\nIf you fail to meet the New Member/Member requirements, you will be kicked!")
await ctx.send(embed=embed)
except Exception as e:
print(e)
@client.command(aliases=['Ticket', 'Tickets', 'ticket'])
async def tickets(ctx):
try:
embed = discord.Embed(title="How to create a ticket?",
color=0x8368ff)
embed.add_field(name="Go to #🎟-tickets-🎟",
value="#🎟-tickets-🎟 is located in the noticeboard category",
inline=False)
embed.add_field(name="Tickets can be created for the following reasons",
value="> Discord Nick/Role Change\n"
"> Do not kick list\n"
"> Problems/Queries/Complaint/Suggestion\n"
"> Reporting a player\n"
"> Milestone\n"
"> Staff Application\n"
"> Event\n"
"> Other",
inline=False)
embed.add_field(name="React to the message sent by @TicketTool",
value="The following image shows you what you need to react to.",
inline=False)
embed.set_image(url=f"https://media.discordapp.net/attachments/522930919984726016/775953643991990272/unknown.png?width=1069&height=702")
await ctx.send(embed=embed)
except Exception as e:
print(e)
@client.command(aliases=['res', 'Res', 'Resident'])
async def resident(ctx):
try:
embed = discord.Embed(title='How to get Resident?',
description='To be eligible for Resident, you must be one of the following',
color=0x8368ff)
embed.add_field(name="Veteran", value="Be in the guild for more than 1 year",
inline=False)
embed.add_field(name="Server Booster", value="Boost the Discord. You will lose resident once your boost expires.",
inline=False)
embed.add_field(name="Youtuber", value="If you're a youtuber with more than 5,000 subscribers, you aren't subject to any guild requirements.",
inline=False)
embed.add_field(name="Sugar Daddy", value="Spend Money on the guild by doing giveaways, sponsoring events!",
inline=False)
embed.set_footer(text=f"Everyone who has the resident rank must get {format(resident_req,',d')} weekly guild experience! (Except YouTubers)")
await ctx.send(embed=embed)
except Exception as e:
print(e)
"------------------------------------------------------------------------------------------------------------------Tickets------------------------------------------------------------------------------------------------------"
# Ticket Handling
@client.event
async def on_guild_channel_create(channel):
try:
while True:
if channel.category.name == "RTickets":
embed = discord.Embed(title="Do you wish to join Miscellaneous in-game?", color=0x8368ff)
embed.add_field(name="If you do", value="Type `Yes`")
embed.add_field(name="If you don't", value="Type `No`")
await channel.send(embed=embed)
reply = await client.wait_for('message', check=lambda x: x.channel == channel)
reply = reply.content
reply = reply.capitalize()
try:
if reply in ('Yes', 'Yeah', 'Ye', 'Yea'):
await channel.send(
'Alright. Kindly wait until staff get in contact with you.'
'\n`You are recommended to leave your present guild (if any) so that staff can invite you to Miscellaneous ASAP`'
'\nIf you get in the guild and want the member role in the discord, use ,sync `Your Minecraft Name` ! ')
time.sleep(3)
embed1 = discord.Embed(title="Miscellaneous Guild Requirements",
description="These requirements are subject to change!",
color=0x8368ff)
embed1.set_author(name="While you wait, kindly take a look a the guild requirements!")
embed1.add_field(name="Active",
value=f"• {format(active,',d')} Weekly Guild Experience",
inline=False)
embed1.add_field(name="Do Not Kick List Eligibility",
value=f"• {format(dnkl,',d')} Weekly Guild Experience",
inline=False)
embed1.add_field(name="Resident", value=f"• {format(resident_req,',d')} Weekly Guild Experience",
inline=False)
embed1.add_field(name="Member",
value=f"• {format(inactive,',d')} Weekly Guild Experience",
inline=False)
embed1.add_field(name="New Member",
value=f"• {format(new_member,',d')} Daily Guild Experience",
inline=False)
embed1.set_footer(text="You are considered a New Member for the first 7 days after joining the guild"
"\nIf you fail to meet the New Member/Member requirements, you will be kicked!")
await channel.send(embed=embed1)
break
elif reply in ('No', 'Nah', 'Nope'):
embed = discord.Embed(title="Did you join the discord to organize a GvG with Miscellaneous?",
color=0x8368ff)
embed.add_field(name="If yes", value="Type `Yes`")
embed.add_field(name="If not", value="Type `No`")
await channel.send(embed=embed)
noreply = await client.wait_for('message', check=lambda x: x.channel == channel)
noreply = noreply.content
noreply = noreply.capitalize()
if noreply in ('Yes', 'Yeah', 'Ye', 'Yea'):
embed = discord.Embed(title="In order to organize a GvG with miscellaneous, "
"kindly list the following and await staff assistance!",
description="• Your guild's plancke"
"\n• Your preferred gamemode"
"\n• Your preferred timezone"
"\n• Number of players",
color=0x8368ff)
embed.set_footer(text="Upon completion of all of the above, kindly await staff assistance!")
await channel.send(embed=embed)
break
elif noreply == "No":
await channel.send(
"**Okay, kindly specify your reason behind joining the Miscellaneous discord and then await staff help!**")
break
else:
embed = discord.Embed(title="My massive computer brain thinks you made a mistake.",
color=0xff0000)
embed.add_field(name="If this is true", value="Type `Yes`", inline=False)
embed.add_field(name="If this is false", value="Type `No`", inline=False)
await channel.send(embed=embed)
errorreply = await client.wait_for('message', check=lambda x: x.channel == channel)
errorreply = errorreply.content
errorreply = errorreply.capitalize()
if errorreply in ('Yes', 'Yeah', 'Ye', 'Yea'):
embed = discord.Embed(title="Great! Let's start over!",
color=0x8368ff)
await channel.send(embed=embed)
else:
embed = discord.Embed(title="Alright! Kindly specify why you joined the discord and await staff assistance!",
color=0x8368ff)
await channel.send(embed=embed)
break
else:
embed = discord.Embed(title="My massive computer brain thinks you made a mistake.",
color=0xff0000)
embed.add_field(name="If this is true", value="Type `Yes`", inline=False)
embed.add_field(name="If this is false", value="Type `No`", inline=False)
await channel.send(embed=embed)
errorreply = await client.wait_for('message', check=lambda x: x.channel == channel)
errorreply = errorreply.content
errorreply = errorreply.capitalize()
if errorreply in ('Yes', 'Yeah', 'Ye', 'Yea'):
embed = discord.Embed(title="Great! Let's start over!",
color=0x8368ff)
await channel.send(embed=embed)
else:
embed = discord.Embed(title="Alright! Kindly specify why you joined the discord and await staff assistance!",
color=0x8368ff)
await channel.send(embed=embed)
break
except Exception as e:
embed = discord.Embed(title="Alright! Kindly specify why you joined the discord and await staff assistance!",
color=0x8368ff)
await channel.send(embed=embed)
error_channel = client.get_channel(523743721443950612)
print(e)
await error_channel.send(
f"Error in {channel.name} while dealing with registration tickets\n{e}\n<@!326399363943497728>")
break
elif channel.category.name == '🎫 Ticket Section':
time.sleep(3)
embed = discord.Embed(title="What's your reason behind creating this ticket?",
description="Please reply with your reason from the list given below!",
color=0x8368ff)
embed.add_field(name="Do-Not-Kick-List", value="Reply with `DNKL`", inline=False)
embed.add_field(name="Role/Username Change", value="Reply with `Role`", inline=False)
embed.add_field(name="Report", value="Reply with `Report`", inline=False)
embed.add_field(name="Problem/Query/Complaint/Suggestion", value="Reply with `General`", inline=False)
embed.add_field(name="Milestone", value="Reply with `Milestone`", inline=False)
embed.add_field(name="Staff Application", value="Reply with `Staff`", inline=False)
embed.add_field(name="GvG Application", value="Reply with `GvG`", inline=False)
embed.add_field(name="Event", value="Reply with `Event`",inline=False)
embed.add_field(name="Other", value="Reply with `Other`", inline=False)
await channel.send(embed=embed)
reply = await client.wait_for('message', check=lambda x: x.channel == channel)
author = reply.author
name = author.nick
if name is None:
name = author.name
reply = reply.content
reply = reply.capitalize()
if reply in ("Dnkl", "Do not kick list", "Do-Not-Kick-List"):
if name is None:
x = author.name
name = x
await channel.edit(name=f"DNKL-{name}", category=discord.utils.get(channel.guild.categories, name="DNKL"))
request = requests.get(f'https://api.mojang.com/users/profiles/minecraft/{name}')
if request.status_code != 200:
await channel.send('Unknown IGN!')
else:
name = request.json()['name']
uuid = request.json()['id']
api = hypixel.get_api()
data = requests.get(f'https://api.hypixel.net/guild?key={api}&player={uuid}').json()
gname = data['guild']['name']
if gname != 'Miscellaneous':
await channel.send('You are not in Miscellaneous')
if len(data) < 2:
print("The user is not in any guild!")
await channel.send('You are not in any guild')
else:
for member in data["guild"]["members"]:
if uuid == member["uuid"]:
member = member
totalexp = member['expHistory']
totalexp = int(sum(totalexp.values()))
if totalexp >= 200000:
eligiblity = True
else:
eligiblity = False
totalexp = (format(totalexp, ',d'))
if eligiblity is False:
embed = discord.Embed(title=name,
url=f'https://visage.surgeplay.com/full/832/{uuid}',
color=0xff3333)
embed.set_thumbnail(
url=f'https://visage.surgeplay.com/full/832/{uuid}')
embed.set_author(name="Do-not-kick-list: Eligibility Check")
embed.set_footer(text="Miscellaneous Bot | Coded by Rowdies")
embed.add_field(name="You are not eligible to apply for the do not kick list.",
value=f"You need a minimum of {format(dnkl,',d')} weekly guild experience."
f"\n You have {totalexp} weekly guild experience.",
inline=True)
await channel.send(embed=embed)
await channel.send(
"Even though you do not meet the requirements, "
"you might still be accepted so we shall proceed with the application process!")
await channel.send("**When will your inactivity begin? (Start date) (DD/MM/YYYY)**")
start = await client.wait_for('message', check=lambda x: x.author == author and x.channel == channel)
start = start.content
await channel.send('**When will your inactivity end? (End date) (DD/MM/YYYY)**')
end = await client.wait_for('message', check=lambda x: x.author == author and x.channel == channel)
end = end.content
await channel.send("**What's the reason behind your inactivity?**")
reason = await client.wait_for('message', check=lambda x: x.author == author and x.channel == channel)
reason = reason.content
await channel.send(
f"Alright! Kindly await staff assistance!"
f"\n**Start:** {start}"
f"\n**End:** {end}"
f"\n**Reason:** {reason}"
f"\n*If you made an error, kindly notify staff by typing after this message*"
f"\n\n||,dnkladd {name} {author.mention} {start} {end} {reason}||"
)
else:
embed = discord.Embed(title=name,
url=f'https://visage.surgeplay.com/full/832/{uuid}',
color=0x333cff)
embed.set_thumbnail(
url=f'https://visage.surgeplay.com/full/832/{uuid}')
embed.set_author(name='Do-not-kick-list: Eligibility Check')
embed.set_footer(text="Miscellaneous Bot | Coded by Rowdies")
embed.add_field(name="You are eligible to apply for the do not kick list.",
value=f"You meet the minimum of {format(dnkl,',d')} weekly guild experience."
f"\n You have {totalexp} weekly guild experience.",
inline=True)
await channel.send(embed=embed)
await channel.send("**When will your inactivity begin? (Start date) (DD/MM/YYYY)**")
start = await client.wait_for('message', check=lambda x: x.author == author and x.channel == channel)
start = start.content
await channel.send('**When will your inactivity end? (End date) (DD/MM/YYYY)**')
end = await client.wait_for('message', check=lambda x: x.author == author and x.channel == channel)
end = end.content
await channel.send("**What's the reason behind your inactivity?**")
reason = await client.wait_for('message', check=lambda x: x.author == author and x.channel == channel)
reason = reason.content
await channel.send(
f"Alright! Kindly await staff assistance!"
f"\n**Start:** {start}"
f"\n**End:** {end}"
f"\n**Reason:** {reason}"
f"\n*If you made an error, kindly notify staff by typing after this message*"
f"\n\n||,dnkladd {name} {author.mention} {start} {end} {reason}||"
)
await channel.send("**Staff, what do you wish to do with this dnkl request?**"
f"\nReply with `Approve` to approve the do-not-kick-list request"
f"\nReply with `Deny` to deny the do-not-kick-list request"
f"\nReply with `Error` if the user made an error while applying for the do not kick list")
while True:
action = await client.wait_for('message', check=lambda
x: staff in x.author.roles)
action = (action.content).capitalize()
if action in ('Approve','Deny','Error'):
if action == "Approve":
a, b, c = start.split('/')
p, q, r = end.split('/')
ign = hypixel.get_dispname(name)
rank = hypixel.get_rank(name)
dates = {1: "January", 2: "February", 3: "March", 4: "April",
5: "May",
6: "June", 7: "July", 8: "August", 9: "September",
10: "October", 11: "November", 12: "December"}
start_month = dates.get(int(b))
end_month = dates.get(int(q))
embed = discord.Embed(title=f"{rank} {ign}",
url=f'https://plancke.io/hypixel/player/stats/{ign}',
color=0x0ffff)
embed.set_thumbnail(
url=f'https://visage.surgeplay.com/full/832/{uuid}')
embed.add_field(name="IGN:", value=f"{ign}", inline=False)
embed.add_field(name="Start:", value=f"{a} {start_month} {c}",
inline=False)
embed.add_field(name="End:", value=f"{p} {end_month} {r}",
inline=False)
embed.add_field(name="Reason", value=f"{reason}", inline=False)
embed.set_author(name="Do not kick list")
await channel.channel.purge(limit=1)
dnkl_channel = client.get_channel(629564802812870657)
message = await dnkl_channel.send(embed=embed)
with open('dnkl.json') as f:
data = json.load(f)
dnkl_dict = {ign: message.id}
data.update(dnkl_dict)
with open('dnkl.json', 'w') as f:
json.dump(data, f)
break
elif action == "Deny":
await channel.send("**This do not kick list request has been denied!")
elif action == "Error":
await channel.send(
"**What is the name of the user you wish to add to the do not kick list?**")
name = await client.wait_for('message', check=lambda
x: x.channel == channel.channel)
name = name.content
ign = hypixel.get_dispname(name)
rank = hypixel.get_rank(name)
request = requests.get(f'https://api.mojang.com/users/profiles/minecraft/{ign}')
uuid = request.json()['id']
with open('dnkl.json') as f:
data = json.load(f)
if request.status_code != 200:
await channel.send('Unknown IGN!')
else:
await channel.send("**What is the start date?** (DD/MM/YYYY)")
start_date = await client.wait_for('message',
check=lambda
x: x.channel == channel.channel)
start_date = start_date.content
await channel.send("**What is the end date?** (DD/MM/YYYY)")
end_date = await client.wait_for('message',
check=lambda
x: x.channel == channel.channel)
end_date = end_date.content
a, b, c = start_date.split('/')
p, q, r = end_date.split('/')
await channel.send("**What's the reason for inactivity?**")
reason = await client.wait_for('message',
check=lambda
x: x.channel == channel.channel)
reason = reason.content
if int(b) > 12:
embed = discord.Embed(title='Please enter a valid date!',
description="`DD/MM/YYYY`",
color=0xff0000)
await channel.send(embed=embed)
if int(q) > 12:
embed = discord.Embed(title='Please enter a valid date!',
description="`DD/MM/YYYY`",
color=0xff0000)
await channel.send(embed=embed)
if int(b) & int(q) <= 12:
dates = {1: "January", 2: "February", 3: "March", 4: "April", 5: "May",
6: "June", 7: "July", 8: "August", 9: "September",
10: "October", 11: "November", 12: "December"}
start_month = dates.get(int(b))
end_month = dates.get(int(q))
embed = discord.Embed(title=f"{rank} {ign}",
url=f'https://plancke.io/hypixel/player/stats/{ign}',
color=0x0ffff)
embed.set_thumbnail(url=f'https://visage.surgeplay.com/full/832/{uuid}')
embed.add_field(name="IGN:", value=f"{ign}", inline=False)
embed.add_field(name="Start:", value=f"{a} {start_month} {c}",
inline=False)
embed.add_field(name="End:", value=f"{p} {end_month} {r}", inline=False)
embed.add_field(name="Reason", value=f"{reason}", inline=False)
embed.set_author(name="Do not kick list")
await channel.channel.purge(limit=1)
dnkl_channel = client.get_channel(629564802812870657)
message = await dnkl_channel.send(embed=embed)
dnkl_dict = {ign: message.id}
data.update(dnkl_dict)
with open('dnkl.json', 'w') as f:
json.dump(data, f)
else:
continue
break
elif reply in ("Role", "Username", "Name"):
await channel.edit(name=f"Role/NameChange-{name}",category=discord.utils.get(channel.guild.categories, name="OTHER"))
await channel.send('What is your minecraft username?')
role_reply = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
name = role_reply.content
ign = hypixel.get_dispname(name)
if ign is None:
await channel.send('Please enter a valid ign!')
await channel.send("I'll restart the process. If you think I made an error, select 'Other' upon restart")
else:
guild_name = hypixel.get_guild(ign)
guest = discord.utils.get(channel.guild.roles, name="Guest")
member = discord.utils.get(channel.guild.roles, name="Member")
awaiting_app = discord.utils.get(channel.guild.roles, name="Awaiting Approval")
xl_ally = discord.utils.get(channel.guild.roles, name="XL - Ally")
#
#
await author.edit(nick=ign)
if guild_name == "Miscellaneous":
await author.remove_roles(guest, awaiting_app)
await author.add_roles(member)
embed = discord.Embed(title="Your nick and role was successfully changed!",
description="await staff assistance.",
color=0x8368ff)
embed.set_footer(text="Member of Miscellaneous"
"\n• Guest & Awaiting Approval were removed"
"\n• Member was given")
await channel.send(embed=embed)
elif guild_name == "XL":
await author.remove_roles(member, awaiting_app)
await author.add_roles(guest, xl_ally)
embed = discord.Embed(title="Your nick and role was successfully changed!",
description="If this wasn't the change you anticipated, "
"await staff assistance.",
color=0x8368ff)
embed.set_footer(text="Member of XL"
"\n• Member & Awaiting Approval were removed"
"\n• Guest & XL - Ally were given")
await channel.send(embed=embed)
elif guild_name not in ("Miscellaneous","XL"):
if str(channel.channel.category.name) == "RTickets":
await channel.send("You aren't in Miscellaneous in-game. Kindly await staff assistance!")
else:
await author.remove_roles(member,awaiting_app)
await author.add_roles(guest)
embed = discord.Embed(title="Your nick and role was successfully changed!",
description="If this wasn't the change you anticipated, "
"await staff assistance.",
color=0x8368ff)
embed.set_footer(text=f"Member of {guild_name}"
f"\n• Member & Awaiting Approval were removed"
f"\n• Guest was given")
await channel.send(embed=embed)
elif reply in "Report":
await channel.edit(name=f"Report-{name}", category=discord.utils.get(channel.guild.categories, name="REPORTS"))
await channel.send(
"Alright. Please provide adequate details about the user and await staff assistance!")
break
elif reply in ("General", "Problem", "Query", "Complaint", "Suggestion"):
await channel.edit(name=f"General-{name}", category=discord.utils.get(channel.guild.categories, name="OTHER"))
await channel.send(
"Alright. Kindly specify the reason you created this ticket and wait for staff assistance!")
break
elif reply == "Milestone":
await channel.edit(name=f"Milestone-{name}", category=discord.utils.get(channel.guild.categories, name="MILESTONES"))
await channel.send(
"Kindly provide a screenshot followed by a message specifying your milestone and then await staff assistance!")
break
elif reply in ('Staff', 'Staff Application', 'Staff App'):
embed = discord.Embed(title="To be eligible to apply for staff,"
" you must meet the following requirements.",
description="• You must be older than 13 years."
"\n• You must have enough knowledge about the bots in this Discord."
"\n• You must be active both on Hypixel and in the guild Discord."
"\n• You must have a good reputation amongst guild members.",
color=0x4b89e4)
await channel.send(embed=embed)
await channel.send("**Do you meet these requirements? (Yes/No)**")
reqs = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
reqs = reqs.content
reqs = reqs.capitalize()
if reqs in ('Yes', 'Ye', 'Yup', 'Y', 'Yeah', 'Yus'):
embed = discord.Embed(title="Does your discord nick match your Minecraft Username?",
description="Kindly reply with a Yes or No",
color=0x4b89e4)
await channel.send(embed=embed)
nickmatching = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
nickmatching = nickmatching.content
nickmatching = nickmatching.capitalize()
if nickmatching in ('Yes', 'Ye', 'Yup', 'Y', 'Yeah', 'Yus'):
if name is None:
x = author.name
name = x
request = requests.get(f'https://api.mojang.com/users/profiles/minecraft/{name}')
uuid = request.json()['id']
await channel.edit(name=f"Staff-Application-{name}", category=discord.utils.get(channel.guild.categories, name="OTHER"))
'''AGE'''
embed = discord.Embed(title="What is your age?",
description="Kindly reply with a number",
color=0x4b89e4)
await channel.send(embed=embed)
age = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
age = age.content
'''VETERENCY'''
embed = discord.Embed(title="For how long have you been in Miscellaneous?",
description="You can check this through \"/g menu\" ingame",
color=0x4b89e4)
await channel.send(embed=embed)
veterency = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
veterency = veterency.content
'''PAST INFRACTIONS'''
embed = discord.Embed(title="Have you had any past infractions on Hypixel?",
description="Kindly reply with a Yes or No",
color=0x4b89e4)
await channel.send(embed=embed)
infractions = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
infractions = infractions.content
infractions = infractions.capitalize()
embed = discord.Embed(title="Kindly make sure that your answers are as detailed as possible."
"\nGiving short answers will hinder your chances at getting staff.",
description="When answering, answer in the form of one message. One question, one message!",
color=0x4b89e4)
await channel.send(embed=embed)
time.sleep(3)
'''------------------------------------------------------Questions------------------------------------------------'''
'''WHY STAFF'''
embed = discord.Embed(title="Why have you decided to apply for staff?",
description="Please make sure that you respond in one message",
color=0x4b89e4)
await channel.send(embed=embed)
whystaff = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
whystaff = whystaff.content
'''WHY MISC'''
embed = discord.Embed(title="What brought you to Miscellaneous, and what has kept you here?",
description="Please make sure that you respond in one message",
color=0x4b89e4)
await channel.send(embed=embed)
whymisc = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
whymisc = whymisc.content
'''Suggest'''
embed = discord.Embed(title="What is something that you could suggest that could improve the guild?",
description="Please make sure that you respond in one message",
color=0x4b89e4)
await channel.send(embed=embed)
suggestion = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
suggestion = suggestion.content
'''SCENARIO 1'''
embed = discord.Embed(title="You have just started as a trial officer and an officer starts arguing with another member. "
"This argument starts to get serious quite quickly. What do you do? ",
description="Make your answer as detailed as possible!",
color=0x4b89e4)
await channel.send(embed=embed)
scen1 = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
scen1 = scen1.content
'''SCENARIO 2'''
embed = discord.Embed(title="Suppose it's your first week of being a trial officer and you guild-mute a well-known player. "
"Your guildmates start spamming you calling you a bad officer and telling you to unmute them. "
"What would you do?",
description="Make your answer as detailed as possible!",
color=0x4b89e4)
await channel.send(embed=embed)
scen2 = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
scen2 = scen2.content
'''SCENARIO 3'''
embed = discord.Embed(title="Upon joining a game and you discover that a guild member is in your game and is hacking. "
"What do you do?",
description="Please make sure that you respond in one message",
color=0x4b89e4)
await channel.send(embed=embed)
scen3 = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
scen3 = scen3.content
'''STAFF'''
embed = discord.Embed(title="Have you been staff in any other guild or on any server? "
"If yes, which one?",
description="Please make sure that you respond in one message",
color=0x4b89e4)
await channel.send(embed=embed)
staff = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
staff = staff.content
'''TIME'''
embed = discord.Embed(title="How much time do you have to contribute to the role? (Per day)",
description="Please make sure that you respond in one message",
color=0x4b89e4)
await channel.send(embed=embed)
time_ = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
time_ = time_.content
'''GENERAL QUESTION'''
embed = discord.Embed(title="Tell us about a time you made a mistake within the last year. "
"How did you deal with it? What did you learn?",
escription="Make your answer as detailed as possible!",
color=0x4b89e4)
await channel.send(embed=embed)
question = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
question = question.content
'''ANYTHING ELSE'''
embed = discord.Embed(title="Anything else you would like us to know?",
color=0x4b89e4)
await channel.send(embed=embed)
random = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
random = random.content
await channel.send("Great! You're done with the application!"
"\nI'm working on compiling the application and I'll send it once I'm done compiling!")
embed = discord.Embed(title=f"{name}'s Staff Application", color=0x4b89e4)
embed.set_thumbnail(url=f'https://visage.surgeplay.com/full/832/{uuid}')
embed.add_field(name="1) What is your age?", value=age, inline=False)
embed.add_field(name="2) How long have you been in the guild for?", value=veterency, inline=False)
embed.add_field(name="3) Have you had any past infractions on Hypixel?", value=infractions, inline=False)
embed.add_field(name="4) Why have you decided to apply for staff?", value=whystaff, inline=False)
embed.add_field(name="5) What brought you to Miscellaneous, and what has kept you here?", value=whymisc, inline=False)
embed.add_field(name="6) What is something you could suggest that would improve the guild?", value=suggestion, inline=False)
embed.add_field(name="7) You have just started as a trial officer and an officer starts arguing with another member. This argument starts to get serious quite quickly. What do you do?", value=scen1, inline=False)
embed.add_field(name="8) Suppose it's your first week of being a trial officer and you guild-mute a well-known player. Your guildmates start spamming you calling you a bad officer and telling you to unmute them. What would you do?", value=scen2, inline=False)
embed.add_field(name="9) Upon joining a game and you discover that a guild member is in your game and is hacking. What do you do?", value=scen3, inline=False)
embed.add_field(name="10) Have you been staff in any other guild or on any server? If yes, which one?", value=staff, inline=False)
embed.add_field(name="11) How much time do you have to contribute to the role? (Per day)", value=time_, inline=False)
embed.add_field(name="12) Tell us about a time you made a mistake within the last year. How did you deal with it? What did you learn?", value=question, inline=False)
embed.add_field(name="13) Anything else you would us to know?", value=random, inline=False)
await channel.send(embed=embed)
await channel.send("If you made any error, make a new ticket, rectify your mistake and copy paste your answer.")
break
else:
await channel.send('What is your minecraft username?')
role_reply = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
name = role_reply.content
ign = hypixel.get_dispname(name)
if ign is None:
await channel.send('Please enter a valid ign!')
await channel.send(
"I'll restart the process. "
"If you think I made an error, select 'Other' upon restart")
else:
guild_name = hypixel.get_guild(name)
guest = discord.utils.get(channel.guild.roles, name="Guest")
member = discord.utils.get(channel.guild.roles, name="Member")
awaiting_app = discord.utils.get(channel.guild.roles, name="Awaiting Approval")
await author.edit(nick=ign)
if guild_name == "Miscellaneous":
await author.remove_roles(awaiting_app)
await author.remove_roles(guest)
await author.add_roles(member)
embed = discord.Embed(title="Your nick and role was successfully changed!",
description="Now let's proceed to your application!",
color=0x8368ff)
await channel.send(embed=embed)
else:
await author.remove_roles(member)
await author.add_roles(guest)
embed = discord.Embed(title="Your nick and role was successfully changed!",
description="Now let's proceed to your application!",
color=0x8368ff)
await channel.send(embed=embed)
request = requests.get(f'https://api.mojang.com/users/profiles/minecraft/{name}')
uuid = request.json()['id']
await channel.edit(name=f"Staff-Application-{name}", category=discord.utils.get(channel.guild.categories, name="OTHER"))
'''AGE'''
embed = discord.Embed(title="What is your age?",
description="Kindly reply with a number",
color=0x4b89e4)
await channel.send(embed=embed)
age = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
age = age.content
'''VETERENCY'''
embed = discord.Embed(title="For how long have you been in Miscellaneous?",
description="You can check this through \"/g menu\" ingame",
color=0x4b89e4)
await channel.send(embed=embed)
veterency = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
veterency = veterency.content
'''PAST INFRACTIONS'''
embed = discord.Embed(title="Have you had any past infractions on Hypixel?",
description="Kindly reply with a Yes or No",
color=0x4b89e4)
await channel.send(embed=embed)
infractions = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
infractions = infractions.content
infractions = infractions.capitalize()
embed = discord.Embed(title="Kindly make sure that your answers are as detailed as possible."
"\nGiving short answers will hinder your chances at getting staff.",
description="When answering, answer in the form of one message. "
"One question, one message!",
color=0x4b89e4)
await channel.send(embed=embed)
time.sleep(3)
#------------------------------------------------------Questions------------------------------------------------
#WHY STAFF
embed = discord.Embed(title="Why have you decided to apply for staff?",
description="Please make sure that you respond in one message",
color=0x4b89e4)
await channel.send(embed=embed)
whystaff = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
whystaff = whystaff.content
#WHY MISC
embed = discord.Embed(title="What brought you to Miscellaneous, "
"and what has kept you here?",
description="Please make sure that you respond in one message",
color=0x4b89e4)
await channel.send(embed=embed)
whymisc = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
whymisc = whymisc.content
#Suggest
embed = discord.Embed(title="What is something that you could suggest that could improve the guild?",
description="Please make sure that you respond in one message",
color=0x4b89e4)
await channel.send(embed=embed)
suggestion = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
suggestion = suggestion.content
#SCENARIO 1
embed = discord.Embed(title="You have just started as a trial officer and an officer starts arguing with another member."
" This argument starts to get serious quite quickly. What do you do? ",
description="Make your answer as detailed as possible!",
color=0x4b89e4)
await channel.send(embed=embed)
scen1 = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
scen1 = scen1.content
#SCENARIO 2
embed = discord.Embed(title="Suppose it's your first week of being a trial officer and you guild-mute a well-known player."
" Your guildmates start spamming you calling you a bad officer and telling you to unmute them."
" What would you do?",
description="Make your answer as detailed as possible!",
color=0x4b89e4)
await channel.send(embed=embed)
scen2 = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
scen2 = scen2.content
#SCENARIO 3
embed = discord.Embed(title="Upon joining a game and you discover that a guild member is in your game and is hacking."
" What do you do?",
description="Please make sure that you respond in one message",
color=0x4b89e4)
await channel.send(embed=embed)
scen3 = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
scen3 = scen3.content
#STAFF
embed = discord.Embed(title="Have you been staff in any other guild or on any server? If yes, which one?", description="Please make sure that you respond in one message", color=0x4b89e4)
await channel.send(embed=embed)
staff = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
staff = staff.content
#TIME
embed = discord.Embed(title="How much time do you have to contribute to the role? (Per day)", description="Please make sure that you respond in one message", color=0x4b89e4)
await channel.send(embed=embed)
time_ = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
time_ = time_.content
#GENERAL QUESTION
embed = discord.Embed(title="Tell us about a time you made a mistake within the last year. How did you deal with it? What did you learn?", description="Make your answer as detailed as possible!", color=0x4b89e4)
await channel.send(embed=embed)
question = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
question = question.content
#ANYTHING ELSE
embed = discord.Embed(title="Anything else you would like us to know?", color=0x4b89e4)
await channel.send(embed=embed)
random = await client.wait_for('message', check=lambda x: x.channel == channel and x.author == author)
random = random.content
msg = await channel.send("Great! You're done with the application!\n I'm working on compiling the application and I'll send it once I'm done compiling!")
try:
embed = discord.Embed(title=f"{name}'s Staff Application", color=0x4b89e4)
embed.set_thumbnail(url=f'https://visage.surgeplay.com/full/832/{uuid}')
embed.add_field(name="1) What is your age?", value=age, inline=False)
embed.add_field(name="2) How long have you been in the guild for?", value=veterency, inline=False)
embed.add_field(name="3) Have you had any past infractions on Hypixel?", value=infractions, inline=False)
embed.add_field(name="4) Why have you decided to apply for staff?", value=whystaff, inline=False)
embed.add_field(name="5) What brought you to Miscellaneous, and what has kept you here?", value=whymisc, inline=False)
embed.add_field(name="6) What is something you could suggest that would improve the guild?", value=suggestion, inline=False)
embed.add_field(name="7) You have just started as a trial officer and an officer starts arguing with another member. This argument starts to get serious quite quickly. What do you do?", value=scen1, inline=False)
embed.add_field(name="8) Suppose it's your first week of being a trial officer and you guild-mute a well-known player. Your guildmates start spamming you calling you a bad officer and telling you to unmute them. What would you do?", value=scen2, inline=False)
embed.add_field(name="9) Upon joining a game and you discover that a guild member is in your game and is hacking. What do you do?", value=scen3, inline=False)
embed.add_field(name="10) Have you been staff in any other guild or on any server? If yes, which one?", value=staff, inline=False)
embed.add_field(name="11) How much time do you have to contribute to the role? (Per day)", value=time_, inline=False)
embed.add_field(name="12) Tell us about a time you made a mistake within the last year. How did you deal with it? What did you learn?", value=question, inline=False)
embed.add_field(name="13) Anything else you would us to know?", value=random, inline=False)
await channel.send(embed=embed)
await channel.send("If you made any error, make a new ticket, rectify your mistake and copy paste your answer.")
except Exception as e:
if e == "400 Bad Request (error code: 50035): Invalid Form Body\nIn embed.fields.9.value: Must be 1024 or fewer in length.":
await msg.edit(content='Failed to compile the data since your message is too long!\n No worries though, the staff team will still go through your application!')
break
else:
await channel.send("Since you don't meet the requirements, there's no point proceeding with the application. Kindly reapply once you meet all the requirements.")
break
elif reply == "Gvg":
await channel.edit(name=f"GvG-Application-{name}", category=discord.utils.get(channel.guild.categories, name="OTHER"))
embed = discord.Embed(title="To be eligible to apply for the GvG Team, you must meet any one of the following game-specific requirements.", color=0x00FFFF)
embed.add_field(name="Bedwars", value="500 Wins\n1.6 Final Kill-Death Ratio", inline=False)
embed.add_field(name="Skywars", value="1000 Wins\n1.2 Kill-Death Ratio", inline=False)
embed.add_field(name="Duels", value="2000 Wins\n1.5 Kill-Death Ratio", inline=False)
embed.add_field(name="Polyvalent (All gamemodes)", value="Must fulfill all requirements", inline=False)
await channel.send(embed=embed)
req = hypixel.get_data(name)
if req["player"] is None:
embed = discord.Embed(title='Unknown IGN', description='Kindly create a new ticket to sync your name and then create another ticket for the GvG Application!', color=0xff0000)
await channel.send(embed=embed)
else:
req = hypixel.get_data(name)
uuid = req['player']['uuid']
x=0
y=0
z=0
#Bedwars
bw_wins = int(req['player']['stats']['Bedwars']['wins_bedwars'])
bw_final_kills = int(req['player']['stats']['Bedwars']['final_kills_bedwars'])
bw_final_deaths = int(req['player']['stats']['Bedwars']['final_deaths_bedwars'])
bw_fkdr = bw_final_kills/bw_final_deaths
bw_fkdr = round(bw_fkdr, 2)
if bw_wins > 500:
x = x + 1
if bw_fkdr > 1.6:
x = x + 1
#Skywars
sw_wins_overall = int(req['player']['stats']['SkyWars']['wins'])
sw_wins_solo = int(req['player']['stats']['SkyWars']['wins_solo'])
sw_wins_doubles = int(req['player']['stats']['SkyWars']['wins_team'])
sw_kills = int(req['player']['stats']['SkyWars']['kills'])
sw_deaths = int(req['player']['stats']['SkyWars']['deaths'])
sw_kdr = sw_kills/sw_deaths
sw_kdr = round(sw_kdr, 2)
if sw_wins_overall > 1000:
y = y + 1
if sw_kdr > 1.2:
y = y + 1
#Duel
duels_wins = int(req['player']['stats']['Duels']['wins'])
duels_losses = int(req['player']['stats']['Duels']['losses'])
duels_kills = int(req['player']['stats']['Duels']['kills'])
duels_wlr = duels_wins/duels_losses
duels_wlr = round(duels_wlr, 2)
if duels_wins > 2000:
z = z + 1
if duels_wlr > 1.5:
z = z + 1