-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
728 lines (715 loc) · 37.2 KB
/
server.js
File metadata and controls
728 lines (715 loc) · 37.2 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
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
const Discord = require("discord.js");
const Enmap = require("enmap");
const events = require("events");
const Rev = require("./rev.js");
const Taran = require("./tara.js");
const Wolf = require("./wolf.js");
const levels = require("./skill_levels");
const fs = require("fs-extra");
const client = new Discord.Client();
const hypixel = require("hypixel-api");
const parser = require("discord-command-parser");
const axios = require("axios");
const nbt = require("prismarine-nbt");
const token = process.env.TOKEN;
const hyClient = new hypixel(process.env.key)
client.apps = new Enmap("apps");
client.questions = new Enmap("questions");
var prefix = client.questions.ensure("prefix","s-");
const defaultq = {
q1: "Please link us your plancke profile (https://plancke.io/hypixel/player/stats/yourignhere):",
q2: "Introduce yourself and your background on hypixel:",
q3: "How did you first learn about our guild?",
q4: "What are you applying for?",
q5: "Have you been banned or muted on hypixel in the last 6 months, and if so why?",
q6: "Do you think you can work well with others?",
q7: "How long do you usually play per week?",
q8: "What gamemode do you think you are the best at?",
q9: "Do you have any stats you would like us to see?",
q10: "Do you have anything else you want to say for your application? (Include revelant info like channel links, etc. Here if applicable.)"
}
Number.prototype.format = function(){
return this.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
};
function getKeyByValue(object, value) {
return Object.keys(object).find(key => object[key] === value);
}
function capitalize(s) {
if(typeof s != "string") return
return s.charAt(0).toUpperCase + s.slice(1);
}
function formatNumber(x) {
return x.toLocaleString()
//return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
client.on('ready', () => {
console.log(`Ready! ${client.user.tag}`);
client.user.setPresence({
activity: {
name: "Skillfully Guild"
},
status: "idle",
type: "WATCHING"
})
});
client.once('ready', ()=>{
const obj = {event: "logged in", time: new Date(Date.now())}
fs.appendFile("./logs.txt", JSON.stringify(obj)+'\n', ()=>{
return
})
})
client.on('message', (message) => {
prefix = client.questions.ensure("prefix", "s-")
try {
if(message.author.bot==true) return
if(message.content.startsWith(`${prefix}stats`)) {
//if(message.channel.id!="713485578150084688") return message.author.send("Sorry but you cant use that command here.")
const args = message.content.split(" ").slice(1)
const username = args[0]
let gamemode = args[1]
const gamemodes = {
bw: "bedwars",
sw: "skywars",
sb: "skyblock"
}
const gamemodes2 = ["bedwars", "skywars", "skyblock", "duels"]
if(!gamemode) return message.channel.send(`You need to specify a gamemode ${message.author}.`)
if(!gamemodes.hasOwnProperty(gamemode.toLowerCase())&&!gamemodes2.includes(gamemode.toLowerCase())) return message.channel.send(`Please choose a proper gamemode, ${message.author}.`)
if(gamemodes.hasOwnProperty(gamemode.toLowerCase())) {
gamemode = gamemodes[gamemode.toLowerCase()]
}
let embed;
hyClient.getPlayer("name", username).then(player=>{
let base;
embed = new Discord.MessageEmbed()
.setColor("#6119a8")
.setFooter("2020 Skillfully Guild", "https://i.ibb.co/GMmBzLY/blue-and-purp.png")
.setThumbnail("https://i.ibb.co/GMmBzLY/blue-and-purp.png")
.setTitle(`Stats for ${username} in \`${gamemode}\``)
.setTimestamp()
if(gamemode == "bedwars") {
base = player.player.stats["Bedwars"]
embed
.addField("Level/Stars:", player.player.achievements.bedwars_level)
.addField("Final Kills", base["final_kills_bedwars"], true)
.addField("Final Deaths", base["final_deaths_bedwars"], true)
.addField("FKDR", Math.round(1000*(base.final_kills_bedwars/base.final_deaths_bedwars))/1000, true)
.addField("\u200b", "\u200b")
.addField("Beds Broken", base.beds_broken_bedwars, true)
.addField("BBLR", Math.round(1000*(base.beds_broken_bedwars/base.losses_bedwars))/1000, true)
.addFields({name: "WLR", value: Math.round(1000*(base.wins_bedwars/base.losses_bedwars))/1000, inline: true})
.setAuthor(message.guild.me.displayName, message.guild.me.user.avatarURL(), null)
return embed
} else if(gamemode == "skywars") {
function sw_xp_to_lvl(xp) {
let xps = [0, 20, 70, 150, 250, 500, 1000, 2000, 3500, 6000, 10000, 15000];
if(xp >= 15000) {
return (xp - 15000) / 10000 + 12;
} else {
for(let i = 0; i < xps.length; i++) {
if(xp < xps[i]) {
return 1 + i + (xp - xps[i-1]) / (xps[i] - xps[i-1]);
}
}
}
}
function getPresFromLevel(level) {
if(level<5) {
return "None"
}
if(level<10) {
return "Iron"
}
if(level<15) {
return "Gold"
}
if(level<20) {
return "Diamond"
}
if(level<25) {
return "Emerald"
}
if(level<30) {
return "Sapphire"
}
if(level<35) {
return "Ruby"
}
if(level<40) {
return "Crystal"
}
if(level<45) {
return "Opal"
}
if(level<50) {
return "Amethyst"
}
if(level<60) {
return "Rainbow"
}
if(level>=60) {
return "Mythic"
}
}
base = player.player.stats.SkyWars
embed
.addField("Level", Math.round(100*sw_xp_to_lvl(base.skywars_experience))/100)
.addField("Prestige", getPresFromLevel(sw_xp_to_lvl(base.skywars_experience)))
.addFields(
{name: "Total games won", value: base.wins, inline: true},
{name: "Total games lost", value: base.losses, inline: true},
{name: "WLR", value: Math.round(1000*(base.wins/base.losses))/1000, inline: true}
)
.addField("\u200b", "\u200b")
.addFields(
{name: "Total kills", value: base.kills, inline: true},
{name: "Deaths", value: base.deaths, inline: true},
{name: "KDR", value: Math.round(1000*(base.kills/base.deaths))/1000, inline: true}
)
return embed
}
if(gamemode=="skyblock") {
let profs = []
const name_to_emoji = {
apple: ":apple: ",
banana: ":banana: ",
blueberry: ":blue_circle: ",
coconut: ":coconut: ",
cucumber: ":cucumber: ",
grapes: ":grapes: ",
kiwi: ":kiwi: ",
lemon: ":lemon: ",
lime: ":green_apple:",
mango: ":mango: ",
orange: ":tangerine: ",
papaya: ":melon: ",
peach: ":peach: ",
pear: ":pear: ",
pineapple: ":pineapple: ",
pomegranate: ":red_circle: ",
raspberry: ":cherries: ",
strawberry: ":strawberry: ",
tomato: ":tomato: ",
watermelon: ":watermelon: ",
zucchini: ":avocado: "
}
const emoji_to_char = {
apple: "🍎",
banana: "🍌",
blueberry: "🔵",
coconut: "🥥",
cucumber: "🥒",
grapes: "🍇",
kiwi: "🥝",
lemon: "🍋",
lime: "🍏",
mango: "🥭",
orange: "🍊",
papaya: "🍈",
peach: "🍑",
pear: "🍐",
pineapple: "🍍",
pomegranate: "🔴",
raspberry: "🍒",
strawberry: "🍓",
tomato: "🍅",
watermelon: "🍉",
zucchini: "🥑"
}
axios.get(`https://api.mojang.com/users/profiles/minecraft/${username}`).then(data=>{
if(!data.status==200) {
let error = new Error(`Error mojang api returned a response code of ${data.status}.`)
throw error
}
let emojis = []
let chars = []
for(let i in player.player.stats.SkyBlock.profiles) {
embed.setTitle(`Please pick a profile for ${username}.`)
var uuid = data.data.id;
let id = player.player.stats.SkyBlock.profiles[i].profile_id
let name = player.player.stats.SkyBlock.profiles[i].cute_name.toLowerCase()
profs.push({
name: name,
id: id,
player: uuid
})
embed.addField("** **",name_to_emoji[name.toLowerCase()]+name)
emojis.push(name)
}
message.channel.send(embed).then(
mssg =>{
const filter = (reaction, user) => {
return user.id == message.author.id&&chars.includes(reaction.emoji.name)
}
for(i in emojis) {
mssg.react(emoji_to_char[emojis[i]])
chars.push(emoji_to_char[emojis[i]])
}
mssg.awaitReactions(filter, {max: 1, time: 10000}).then(
collected=>{
const reaction="/?originalUrl=https%3A%2F%2Fgithub.com%2Fcollected.first()%3B%253C%2Fdiv">
if(collected.size == 0) {
const userReactions = mssg.reactions.cache.filter(reaction="/?originalUrl=https%3A%2F%2Fgithub.com%2F%26gt%3B%2520reaction.users.cache.has(client.user.id))%3B%253C%2Fdiv">
try {
for (const reaction of userReactions.values()) {
reaction.users.remove(client.user.id);
}
} catch (error) {
console.log('Failed to remove reactions.');
}
return
} else {
var pname = getKeyByValue(emoji_to_char, reaction.emoji.name)
for(i in profs) {
if(pname == profs[i].name) {
var pid =profs[i].id
}
}
axios.get(`https://api.hypixel.net/skyblock/profile?key=${process.env.key}&profile=${pid}`).then(res=>{
if(res.data.success!=true) {
message.channel.send("An error occured!")
}
const embed = new Discord.MessageEmbed()
try {
var data = res.data.profile.members[uuid]}
catch {message.channel.send("An error occured, please try again!")
return
}
try {
if(res.data.profile.banking)var bal = Math.round(res.data.profile.banking.balance * 1000) / 1000
else var bal = "N/A"
if(data.experience_skill_combat)var combat =levels.getLevelByXp(data.experience_skill_combat)
else var combat = {level: "N/A", current: "N/A", next: "N/A"}
if(data.experience_skill_foraging)var foraging =levels.getLevelByXp(data.experience_skill_foraging)
else var foraging = {level: "N/A", current: "N/A", next: "N/A"}
if(data.experience_skill_enchanting)var enchanting = levels.getLevelByXp(data.experience_skill_enchanting)
else var enchanting = {level: "N/A", current: "N/A", next: "N/A"}
if(data.experience_skill_fishing)var fishing =levels.getLevelByXp(data.experience_skill_fishing)
else var fishing = {level: "N/A", current: "N/A", next: "N/A"}
if(data.experience_skill_mining)var mining =levels.getLevelByXp(data.experience_skill_mining)
else var mining = {level: "N/A", current: "N/A", next: "N/A"}
if(data.experience_skill_runecrafting)var runecrafting =levels.getLevelByXp(data.experience_skill_runecrafting, true)
else var runecrafting = {level: "N/A", current: "N/A", next: "N/A"}
if(data.experience_skill_taming)var taming = levels.getLevelByXp(data.experience_skill_taming)
else var taming = {level: "N/A", current: "N/A", next: "N/A"}
if(data.experience_skill_alchemy)var alch = levels.getLevelByXp(data.experience_skill_alchemy)
else var alch = {level: "N/A", current: "N/A", next: "N/A"}
if(data.experience_skill_farming)var farming = levels.getLevelByXp(data.experience_skill_farming)
else var farming = {level: "N/A", current: "N/A", next: "N/A"}
if(data.experience_skill_carpentry)var carpentry = levels.getLevelByXp(data.experience_skill_carpentry)
else var carpentry = {level: "N/A", current: "N/A", next: "N/A"}
if(data.slayer_bosses.zombie.xp)var zombie =levels.getSlayerByXp(data.slayer_bosses.zombie.xp)
else var zombie = {level: "N/A", current: "N/A", next: "N/A"}
if(data.slayer_bosses.wolf.xp)var wolf = levels.getSlayerByXp(data.slayer_bosses.wolf.xp, true)
else var wolf = {level: "N/A", current: "N/A", next: "N/A"}
if(data.slayer_bosses.spider.xp)var spider = levels.getSlayerByXp(data.slayer_bosses.spider.xp)
else var spider = {level: "N/A", current: "N/A", next: "N/A"}
if(!data.experience_skill_combat||!data.slayer_bosses.zombie.xp) throw new Error("Api disabled/info missing")
} catch (error) {
message.channel.send("Sorry, an error occured. Some data is missing and will not be included.")
console.log(error)
}
if(!data.fairy_souls_collected) data.fairy_souls_collected = 0
mssg.delete()
const asl = (foraging) ? Math.round(((alch.level + combat.level + enchanting.level + fishing.level
+ mining.level + farming.level + foraging.level+taming.level)/8)*1000)/1000 : "N/A"
embed
.setTitle(`Skyblock stats for ${username} on ${pname}`)
.setAuthor(`${client.user.tag}`, "https://i.ibb.co/GMmBzLY/blue-and-purp.png", "https://discord.gg/z3Z8dkE")
.setColor("#6119a8")
.setDescription("Stats might not be 100% accurate due to rounding. Partial progress is not taken into account when calculating average skill levels.")
.setThumbnail("https://i.ibb.co/GMmBzLY/blue-and-purp.png")
.setTimestamp()
.setFooter("2020 Skillfully Guild", "https://i.ibb.co/GMmBzLY/blue-and-purp.png")
.addFields(
{name: "Bank Balance", value: Math.round(bal * 100)/100 + " coins"},
{
name: "Combat :crossed_swords:", value: `Level: ${combat.level}`, inline: true},
{name: "Alchemy :alembic:", value: `Level: ${alch.level}`, inline: true},
{name: "Mining :pick:", value: `Level: ${mining.level}`, inline: true},
{name: "Farming :bread:", value: `Level: ${farming.level}`, inline: true},
{name: "Carpentry :hammer:", value: `Level: ${carpentry.level}`, inline: true},
{name: "Foraging :axe:", value: `Level: ${foraging.level}`, inline: true},
{name: "Fishing :fishing_pole_and_fish:", value: `Level: ${fishing.level}`, inline: true},
{name: "Enchanting :book:", value: `Level: ${enchanting.level}`, inline: true},
{name: "Taming :bone:", value: `Level: ${taming.level}`, inline: true},
{name: "Runecrafting :sparkler:", value: `Level: ${runecrafting.level}`, inline: true},
{name: "Average Skill Level :tools:", value: asl},
{name: "Slayers :bow_and_arrow:", value: "\u200b"},
{name: "Zombie :zombie:", value: `Level: ${zombie.level}, \n Next level in ${zombie.next} xp.(${data.slayer_bosses.zombie.xp} currently)`, inline: true},
{name: "Spider :spider:", value: `Level: ${spider.level}, \n Next level in ${spider.next} xp.(${data.slayer_bosses.spider.xp} currently)`, inline: true},
{name: "Wolf :wolf:", value: `Level ${wolf.level}, Next \n level in ${wolf.next} xp.(${data.slayer_bosses.wolf.xp} currently)`, inline: true},
{name: ":heartpulse: Fairy Souls: ", value: `${data.fairy_souls_collected}/206`}
)
return embed
}).then(embed=>{
if(embed) message.channel.send(embed)
else return null
})
}
}
)
}
)
})
}
else if (gamemode == "bridge") {
base = player.player.stats.Duels
let solo = "bridge_duel_"
embed.setDescription("Stats for `The Bridge`.")
embed.addFields({name: "Solo", value: "** **"},
{name: "** **",value: "** **"},
{name: "Wins", value: base[solo+"wins"], inline: true},
{name: "Losses", value: base[solo+"losses"], inline: true},
{name: "W/L Ratio", value: Math.round((base[solo+"wins"]/base[solo+"losses"])*100)/100, inline: true},
{name: "Kills", value: base[solo+"bridge_kills"], inline: true},
{name: "Deaths", value: base[solo+"bridge_deaths"], inline: true},
{name: "K/D Ratio", value: Math.round((base[solo+"bridge_kills"]/base[solo+"bridge_deaths"])*100)/100 , inline: true})
return embed
}
}).then(j=>{if(j)message.channel.send(j)}
)
.catch(
error=>{
if(error) console.log(error)
if(error=="SyntaxError: Unexpected token < in JSON at position 0"||error=="SyntaxError: Unexpected end of JSON input") {message.channel.send("Hypixel api might be down right now. Try again later."); return null} else
message.channel.send("An error occured, are you sure that player exists?")
}
)
} else if(message.content.startsWith(`${prefix}slayer`)) {
const args = message.content.split(" ").slice(1)
let countoverride
if(!args[0]) return message.channel.send("You didnt specify a slayer.")
const slayer = args[0].toLowerCase()
if(!args[1]||isNaN(parseInt(args[1]))) {
return message.channel.send("You didnt specify an amount.")
}
if(!args[2]||isNaN(parseInt(args[2]))) {
args.push(0)
message.channel.send("No magic find was specified so it defaults to 0.").then(msg=>msg.delete({timeout: 5000}))
}
let magic = parseInt(args[2])
if(magic>1000) magic=1000
if(!countoverride)var count = (args[1]>10000) ? 10000 : args[1]
else var count = 1
const embed = new Discord.MessageEmbed()
.setTitle(`Results of ${count} bosses using ${magic}% magic find.`)
.setDescription("All rngesus drop chances are pure speculation and may not reflect actual chances in game. Maximum amount is 10000. Max magic find is 1000")
.setTimestamp()
.setFooter("2020 Skillfully Guild", "https://i.ibb.co/GMmBzLY/blue-and-purp.png")
.setThumbnail("https://i.ibb.co/GMmBzLY/blue-and-purp.png")
if(slayer.toLowerCase().startsWith("rev") || slayer.toLowerCase()=="zombie") {
let totals = {
flesh: 0,
foul: 0,
pest: 0,
undead: 0,
smite: 0,
droppedFoul: 0,
revCata: 0,
snake: 0,
horror: 0,
scythe: 0,
rares: 0,
sell: 0
}
for(var i = 0; i<count; i++){
let rev = new Rev(magic)
rev.getDrops()
totals.sell += rev.sell
if(rev.rare) {
totals.rares += 1
}
for(drop in rev.drops) {
totals[drop] += parseInt(rev.drops[drop])
}
}
embed.addFields(
{name:"Profit", value: (totals.sell - 50000*count).format() + " coins"},
{name: "Cost", value: (50000*count).format()},
{name: "Sell", value: totals.sell},
{name: "Total rare drops obtained (1% chance or under):", value: totals.rares},
{name: "Revenant flesh", value: totals.flesh.format(), inline: true},
{name: "Foul flesh", value: totals.foul.format(), inline: true},
{name: "Pest. Rune", value: totals.pest.format(), inline: true},
{name: "Undead catalysts", value: totals.undead.format(), inline: true},
{name: "Smite VI book", value: totals.smite.format(), inline: true},
{name: "Rev. catalysts", value: totals.revCata.format(), inline: true},
{name: "Beheaded Horrors", value: totals.horror.format(), inline: true},
{name: "Snake Runes", value: totals.snake.format(), inline: true},
{name: "Scythe Blades", value: totals.scythe.format(), inline: true}
)
message.channel.send(embed)
} else if(slayer.toLowerCase().startsWith("tara")||slayer.toLowerCase()=="spider") {
let totals = {
web: 0,
toxic: 0,
bite: 0,
spider: 0,
bane: 0,
fly: 0,
tarantula: 0,
digmosq: 0,
rares: 0,
sell: 0,
droppedToxic: 0
}
for(var i = 0; i<count; i++) {
let newTara = new Taran(magic)
newTara.getDrops()
totals.web += newTara.drops.web
totals.toxic += newTara.drops.toxic
totals.bite += newTara.drops.bite
totals.spider += newTara.drops.spider
totals.bane += newTara.drops.bane
totals.fly += newTara.drops.fly
totals.tarantula += newTara.drops.tarantula
totals.digmosq += newTara.drops.digmosq
if(newTara.drops.toxic != 0) {
totals.droppedToxic += 1
}
if(newTara.rare) {
totals.rares += 1
}
totals.sell += newTara.sell
}
embed.addFields(
{name:"Profit", value: (totals.sell - 50000*count).format() + " coins"},
{name: "Cost", value: (50000*count).format()},
{name: "Sell", value: totals.sell},
{name: "Total rare drops obtained (1% chance or under):", value: totals.rares.format()},
{name: "Tarantula web", value: totals.web.format(), inline: true},
{name: "Toxic arrow poison", value: totals.toxic.format(), inline: true},
{name: "Bite Rune", value: totals.bite.format(), inline: true},
{name: "Spider catalysts", value: totals.spider.format(), inline: true},
{name: "Bane VI book", value: totals.bane.format(), inline: true},
{name: "Flyswatters", value: totals.fly.format(), inline: true},
{name: "Tarantula talismans", value: totals.tarantula.format(), inline: true},
{name: "Digested Mosquitoes", value: totals.digmosq.format(), inline: true}
)
message.channel.send(embed)
}
if(slayer.toLowerCase()=="wolf" || slayer.toLowerCase().startsWith("sven")) {
const totals = {
sell: 0,
teeth: 0,
wheel: 0,
spirit: 0,
crit: 0,
claw: 0,
corture: 0,
bait: 0,
overflux: 0,
sell: 0,
rares: 0,
droppedWheel: 0
}
for(var i = 0; i<count; i++) {
let newSven = new Wolf(magic)
newSven.getDrops()
for(var j in newSven.drops) {
totals[j]+=newSven.drops[j]
totals.sell += newSven.sell
if(newSven.rare) totals.rares += 1
if(newSven.wheel) totals.droppedWheel += 1
}
}
embed.addFields(
{name: "profit", value: totals.sell-50000*count},
{name: "Cost", value: 50000*count},
{name: "Sell", value: totals.sell},
{name: "Total rare drops obtained (1% chance or under):", value: totals.rares.format()},
{name: "Wolf teeth: ", value: totals.teeth.format(), inline: true},
{name: "Hamster wheels", value: totals.wheel.format(), inline: true},
{name: "Spirit runes", value: totals.spirit.format(), inline: true},
{name: "Critical VI", value: totals.crit.format(), inline: true},
{name: "Red claw eggs", value: totals.claw.format(), inline: true},
{name: "Corture runes", value: totals.corture.format(), inline: true},
{name: "Grizzly bait", value: totals.bait.format(), inline: true},
{name: "Overflux Capacitors", value: totals.overflux.format(), inline: true}
)
message.channel.send(embed)
}
}
//`https://api.hypixel.net/skyblock/profile?key=${process.env.key}&profile=${id}`
if(message.author.id=="402639792552017920"&&message.content=="s-test") {
message.reply("test");
}
if(message.content==`${prefix}apply`) {
(async()=>{
var current = client.apps.get(message.author.id);
if(current) {
return message.channel.send("You have already applied. Please wait for your application to be processed before submitting another one.")
}
message.reply("application started in dms!")
client.apps.set(message.author.id, "In Progress")
const responses = {}
const questions = client.questions.ensure("questions", defaultq);
const max = Object.keys(questions).length
const msg = await message.author.send("Application started.");
const collector = msg.channel.createMessageCollector(m => m.content!="** **"&&m.author!=client.user, {max: max, time: 300000});
collector.on("end", async (collected, err) => {
if(collected.size<1) {
client.apps.delete(message.author.id);
return msg.channel.send("No response. Stopping application...")}
if(collected.size<10) {
client.apps.delete(message.author.id);
return msg.channel.send("You need to respond to every question. In the allocated time limit.")}
const confirm = await msg.channel.send("Do you want to submit?")
const agree = await confirm.react('✅');
//const deny = await confirm.react('❌');
const filter = (reaction)=> (reaction="/?originalUrl=https%3A%2F%2Fgithub.com%2F%3Dagree%26amp%3B%26amp%3Breaction.author!%3Dclient.user)%2F*%7C%7C(reaction%3D%3Ddeny%26amp%3B%26amp%3Breaction.author!%3Dclient.user)*%2F%2520%253C%2Fdiv">
try {
const answers = await confirm.awaitReactions(filter, {time: 30000, max: 1})
if(answers.first()) {
if(answers.first()==agree) {
const info = {name: message.author.username+"#"+message.author.discriminator,
guild: message.guild.id, key: message.author.id}
client.apps.set(message.author.id, {questions: questions, answers: responses, info: info})
const logs = message.guild.channels.cache.find(channel=>channel.name=="application-logs")
const ans = client.apps.get(message.author.id)
//logs.first().send(require("util").inspect(client.apps.get(message.author.id)), {code: "js", split: true})
const embed = new Discord.MessageEmbed().setTitle("Application").setTimestamp().setColor("#46008c").setFooter(message.guild.me.displayName, "https://i.ibb.co/GMmBzLY/blue-and-purp.png").setDescription("Application made by "+ans.info.name).setAuthor("Skillfully Bot", "https://i.ibb.co/GMmBzLY/blue-and-purp.png", null);
for(var p in ans.questions) {
embed.addField(ans.questions[p], ans.answers[p])
}
embed.addField("Application ID",ans.info.key)
logs.send(embed)
} /*else if(answers.first()==deny) {
client.apps.delete(message.author.id)
return msg.channel.send("Ok. Cancelling application.")
}*/
}
if(answers.size==0) {
msg.channel.send("No reply. Closing application.")
return client.apps.delete(message.author.id)
}
}
catch (e){
console.log(e)
client.apps.delete(message.author.id)
}
})
for(j in questions) {
msg.channel.send(questions[j])
responses[j] = (await collector.next).content
}
})();
}
if(message.author.id=="402639792552017920"&&message.content.startsWith(`${prefix}help`)) {
const args = message.content.trim().split(' ').slice(1).join(" ")
const embed = new Discord.MessageEmbed();
embed.setAuthor("Skillfully Bot", "https://i.ibb.co/GMmBzLY/blue-and-purp.png", null);
embed.setTitle("Skillfully Bot help");
embed.setDescription("Prefix: `s-`\n For questions or feedback, please contact a staff member. Source code is available in #announcements.")
embed.addFields({name: "Commands", value: "** **"}, {name: "apply", value:"Apply for the guild or a role in the discord."}, {name: "stats <ign> <game> [submode]", value:"Gets hypixel stats of a player in a certain mode. Use `"+prefix+"help stats` for a list of gamemodes."})
message.channel.send(embed)
}
if(message.content.startsWith(`s-settings`)) {
if(!message.member.hasPermission("MANAGE_GUILD")) return message.channel.send("You do not have permission to do this!")
const args = message.content.split(" ").slice(1)
if(args[0]=="prefix") {
client.questions.set("prefix", args[1])
return message.channel.send(`${message.author}, the prefix was changed to \`${args[1]}\`!`)
}
if(args[0]=="questions") {
const index = args[1]
const question = args.slice(2)
const join = "q"+index
client.questions.set("questions", question.join(" "), join)
}
}
if(message.content.startsWith(`${prefix}reject`)||message.content.startsWith(`${prefix}deny`)) {
if(!message.member.hasPermission("MANAGE_GUILD")) return message.channel.send("You do not have permission to do that!")
const args = message.content.split(" ").slice(1)
const id = args[0];
const msg = args.slice(1);
if(!msg) return message.channel.send("You need to add a rejection message.")
if(!parseInt(id)) return message.channel.send("Please use application id.")
const apps = client.apps.get(id)
if(client.apps.get(id)) {
client.apps.delete(id)
message.channel.send(apps.info.name+" was rejected!")
const embed = new Discord.MessageEmbed().setTitle("Application Rejected").addField("Message", msg.join(" ")||"Your application was denied. Please contact a staff member if you have any questions.")
client.users.cache.get(id).send(embed)
message.reply("done!")
}
}
if(message.content.startsWith(`${prefix}accept`)) {
if(!message.guild.me.hasPermission("MANAGE_GUILD")) return message.channel.send("You do not have permission.")
let args = message.content.split(" ").slice(1);
args = args.join(" ").split("-").slice(1);
let roles = args.filter(e=>e.startsWith("r"))
roles.forEach((v, i)=>roles[i]=message.guild.roles.cache.find(e=>e.name==v.split("").slice(1).join("").trim()))
let messages = args.filter(e=>e.startsWith("m"))
messages.forEach((v,i)=>message[i]=v.split("").slice(1).join("").trim());
messages = messages.join(" ");
let id = args.find(e=>e.startsWith("i")).split("").slice(1).join("").trim()
if(!id) return message.channel.send("You need to specify an id.")
if(!roles&&!message) return message.channel.send("You need to give at least a role or message.");
let app = client.apps.get(id);
if(!app) return message.channel.send("No application was found with that id.")
if(roles) {
for(i of roles) {
let member = message.guild.members.cache.get(id)
member.roles.add(i).catch(e=>{console.log(e); return message.channel.send("Sorry, an error occured. I might not have access to that role!")})
}
}
if(messages) {
if(client.users.cache.get(id)) {
const embed = new Discord.MessageEmbed().setTitle("Application Accepted!").addField("Message", messages)
client.users.cache.get(id).send(embed)
}
}
client.apps.delete(id)
message.reply("done!")
}
if(message.content==`${prefix}clearapps`) {
if(!message.member.hasPermission("MANAGE_GUILD"))return message.channel.send("You do not have permission to run that command.")
client.apps.deleteAll();
message.channel.send("Applications cleared. :thumbsup:")
}
if(message.content=="<@!727555453134831616> prefix") {
message.reply(`the prefix in ${message.guild.name} is \`${prefix}\``)
}
if(message.content.startsWith("s-eval")&&message.author.id=="402639792552017920"){
(async()=>{
const args = message.content.split(" ").slice(1)
const clean = text => {
if (typeof text === "string")
return text
.replace(/`/g, "`" + String.fromCharCode(8203))
.replace(/@/g, "@" + String.fromCharCode(8203));
else return text;
};
try {
const code = args.join(" ");
let evaled = await eval(code);
console.log(`Trying to evaluate ${code}`);
if (typeof evaled !== "string")
evaled = require("util").inspect(evaled);
evaled = evaled
.toString()
message.channel.send(clean(evaled), { code: "js", split: true });
} catch (err) {
console.error(err);
message.channel.send(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``);
}})();
}
if(message.channel.id=="786379924067713024"&&message.content!="j"&&message.author.id!="402639792552017920") message.delete();
}catch (err){
const date = new Date(Date.now())
console.log(err)
let obj = {
event: "error",
time: date+"\n",
author: message.author.tag+"\n",
content: message.content+"\n",
error: err.toString() + '\n'
}
fs.appendFile('./logs.txt', JSON.stringify(obj) + '\n', error=>{
if(error) {console.log(error);}
})
}
});
client.login(token);
You can’t perform that action at this time.