-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
508 lines (472 loc) · 24.5 KB
/
index.js
File metadata and controls
508 lines (472 loc) · 24.5 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
const Discord = require('discord.js')
const { Partials } = require('discord.js')
const client = new Discord.Client({
disableEveryone: true,
intents: ['Guilds', 'GuildMessages', 'GuildMessageReactions', 'MessageContent', 'DirectMessages'],
partials: [Partials.Message, Partials.Channel, Partials.Reaction]
})
const token = process.env['TOKEN']
const progressbar = require('string-progressbar');
const Enmap = require("enmap")
const teams = new Enmap({
name: "teams"
})
const teamLeaders = new Enmap({
name: "leaders"
})
teamLeaders.set("leaders", ['506404829112041472', '719037635909386321', '833792409539444746', '684799123395706950'])
client.fetch = (...args) => import('node-fetch').then(({ default: fetch }) => fetch(...args));
let a = ["abhi lunch time hai baad me aana", "ab aap lunch karo jaake fir baat karenge", "dinner kab karoge?", "breakfast bhi to krna hai"]
client.on("messageCreate", async message => {
if (message.author.bot) return;
if (message.channel.id === '984746441002057757') message.delete()
/* if (message.channel.isDMBased() && message.attachments && message.attachments.first()) {
message.channel.send("Your message has been sent.")
client.channels.cache.get("1005060732234248263").send({ content: "Verification for " + message.author.toString() + "\n" + message.attachments.first().url + "\nTo accept, add the roles to the user and verify from #verification channel" })
} else if (message.channel.isDMBased() && !message.attachments?.first()) {
client.channels.cache.get("1005060732234248263").send(message.author.toString() + ":- " + message.content)
}*/
if (!message.guild) return;
if (message.channel.id === '984746441421496346' && message.author.id === '915138167764549703') {
//
}
if (message.guild.id !== '984746440867844106') {
if (message.content === 'no') message.react("881939354900127824")
}
if (!message.content.startsWith(';')) return;
const args = message.content.slice(1).split(/ +/g);
const command = args.shift().toLowerCase()
// user commands
if (command === 'team' && (message.guild.id !== '984746440867844106')) {
if (!args[0]) return message.reply(";team position\n;team join\n;team leave\n;team info")
if (args[0] === 'create') {
let name = args[1]
if (!name) return message.reply("You have to mention a 1 word name `;team create name`")
if (teams.has(name)) return message.reply("Name already taken.")
if (!isNaN(args[0])) return message.reply("what is that name :/")
teams.set(name, [])
message.channel.send("Created team `" + name + "`")
teamLeaders.push("leaders", message.author.id)
teams.push(name, message.author.id)
}
if (args[0] === 'position') {
let stats = teams.map((t, name) => (name === 'panipuri' ? "" : "") + name + ": " + progressbar.filledBar(30, t.length, 30)[0] + " " + t.length).reverse()
let teamPos = new Discord.EmbedBuilder()
.setTitle("Team stats")
.setDescription(stats.join("\n"))
message.channel.send({ embeds: [teamPos] })
} else if (args[0] === 'join') {
if ((teams.has('pattagobhi') && teams.includes("pattagobhi", message.author.id)) || (teams.has('panipuri') && teams.includes("panipuri", message.author.id))) return message.reply("You are already in a team!")
if (teams.has(args[1].toLowerCase())) {
teams.push(args[1].toLowerCase(), message.author.id)
message.reply("You joined " + args[1] + "!")
}
} else if (args[0] === 'leave') {
if (teams.has("panipuri") && teams.includes("panipuri", message.author.id)) teams.remove("panipuri", message.author.id)
else {
if (teams.has('pattagobhi')) teams.remove("pattagobhi", message.author.id)
}
message.channel.send("You left your team.")
} else if (args[0] === 'info') {
let search = args[1]
if (!search) return message.reply("You have to mention a team ;team info name")
if (!teams.has(search)) return
let emb = new Discord.EmbedBuilder()
.setTitle("Members of " + search)
.setDescription(teams.get(search).map(m => "<@" + m + ">").join("\n"))
message.channel.send({ embeds: [emb] })
} else if (args[0] === 'attack') {
let search = args[1]
let leaders = teamLeaders.get("leaders")
if (!search) return message.reply("You have to mention a team ;team attack name")
if (!teams.has(search)) return;
if (!leaders.includes(message.author.id)) return message.reply("you can't initiate an attack without being a team leader")
let e = new Discord.EmbedBuilder()
.setTitle(message.author.username + " is attacking " + search + "!")
.setDescription("Help him by joining his attack")
let row = new Discord.ActionRowBuilder().addComponents([new Discord.ButtonBuilder().setCustomId("join").setStyle("Secondary").setLabel("Join")])
message.reply({ content: "6 people have to join to begin", components: [row], embeds: [e] })
.then(m => {
let joined = []
let filter = i => !joined.includes(i.user.id)
let col = m.createMessageComponentCollector({ filter, time: 180000 })
col.on("collect", i => {
if (i.customId === 'join') {
joined.push(i.user.id)
ee = m.embeds[0]
ee.data.description = ("Help him by joining his attack\n\n<@" + joined.join(">, <@") + ">")
i.update({ embeds: [ee] })
if (joined.length > 5) {
teams.delete(search)
message.channel.send("Lets go..")
setTimeout(() => { message.channel.send("RIP team " + search + ", they got absolutely demolished and no longer is a team") }, 4000)
col.stop()
}
}
})
})
}
}
if (command === 'ping') {
const pingEmbed = Discord.EmbedBuilder.from({
color: '322478',
title: 'Ping? ',
description: `:robot:Latency: Pinging...
:signal_strength:API Latency: Pinging...`
})
const m = await message.channel.send({ embeds: [pingEmbed] })
let latency = m.createdTimestamp - message.createdTimestamp
const goodness = () => {
let v = ''
if (latency < 50) v = 'Excellent'
else if (latency < 100) v = 'Very good'
else if (latency < 150) v = 'Good'
else if (latency < 200) v = 'Ok'
else if (latency < 300) v = 'Normal'
else if (latency < 1000) v = 'Not good'
else v = 'Worst'
return v;
}
pingEmbed.setTitle('Pong!')
pingEmbed.setDescription(`:robot:Latency: ${latency}ms ( **${goodness()}** )
:signal_strength:API Latency: ${Math.round(message.client.ws.ping)}ms`)
m.edit({ embeds: [pingEmbed] })
}
if (command === 'reply') {
let [id, ...msg] = args
if (!id || !msg) return message.reply("Usage: ;reply <id> message")
await message.guild.members.fetch(id).catch(e => { })
let mem = message.guild.members.cache.get(id)
if (!mem) return message.reply("Member not found, use his id. ;reply <id> <msg>")
mem.send(msg.join(" "))
message.react("📨")
}
if (command === 'avatar' || command === 'pfp') {
let m = message.member
if (message.mentions.members?.first()) m = message.mentions.members.first()
const e = new Discord.EmbedBuilder()
.setColor(m.roles.highest.color || "Random")
.setAuthor({ name: m.tag || m.user.tag, iconURL: m.user.displayAvatarURL() })
.setTitle("Avatar")
.setImage(m.displayAvatarURL())
message.channel.send({ embeds: [e] })
} else if (command === 'nitro') {
let button = (claimed) => new Discord.ActionRowBuilder().addComponents([new Discord.ButtonBuilder().setLabel(" Accept ").setCustomId("accept").setStyle(claimed ? "Secondary" : "Success").setDisabled(claimed ? true : false)])
let ee = new Discord.EmbedBuilder()
.setColor("#36393F")
.setTitle("You've been gifted a subscription!")
.setDescription("You've been gifted a 1 Month Nitro Subscription!")
.setThumbnail("https://i.imgur.com/w9aiD6F.png")
let m = await message.channel.send({ components: [button(false)], embeds: [ee] })
let newEmb = ee
newEmb.data.description = "Uh oh, Looks like someone already claimed this gift."
let filter = (i) => true
let col = m.createMessageComponentCollector({ filter, time: 65000 })
col.on("collect", i => {
i.reply({ ephemeral: true, content: "https://i.imgur.com/NQinKJB.mp4" })
m.edit({ embeds: [newEmb], components: [button(true)] })
})
col.on("end", i => {
m.edit({ embeds: [newEmb], components: [button(true)] })
})
} else if (command === 'robux') {
let rickroll = new Discord.EmbedBuilder()
.setDescription('[Click here for free robux](https://www.youtube.com/watch?v=dQw4w9WgXcQ)')
return message.channel.send({ embeds: [rickroll] })
} else if (command === 'help') {
//====================HELP CMD====================
let cmds = ["avatar", "help", "nitro", "robux", "team", "ping", "coinflip", "rps"]
let help = new Discord.EmbedBuilder()
.setTitle("Commands")
.setDescription("`;" + cmds.join("`, `;") + "`\n\n**Admin**\n`;eval`, `;create-self-roles`, `;yeet`, `;ban`, `;kick`, ... secret commands")
return message.channel.send({ embeds: [help] })
} else if (command === "..." && (args.join(" ") === "secret commands")) {
let t = 0
let text = `You are the chosen one
Congratulations on finding one of the many secret commands
Best of Luck on your Journey
May the Force be with you`
text.split("\n").map(async m => {
setTimeout(() => { message.author.send(m) }, t)
t += 3000
})
} else if (command === 'coinflip' || command === 'cf') {
let a = ['heads', 'tails']
message.reply(a[Math.floor(Math.random() * a.length)])
} else if (command === 'rps') {
let check = (user1, option1, user2, option2) => {
let a = ["rock", "paper", "scissors"]
if (option1 === a[0]) {
if (option2 === a[1]) return user2
else if (option2 === a[2]) return user1
}
else if (option1 === a[1]) {
if (option2 === a[0]) return user1
else if (option2 === a[2]) return user2
}
else if (option1 === a[2]) {
if (option2 === a[0]) return user2
else if (option2 === a[1]) return user1
}
else if (option1 === option2) {
return "lol no one"
}
}
let member = message.mentions.members.first() || message.guild.members.cache.get(args[0])
if (!member) return message.reply("Tag someone to play with.")
if (member.id === message.author.id) return message.reply("Play with me instead of playing with urself :/")
let filter = i => [message.author.id, member.id].includes(i.user.id)
const chosen = {}
let row = new Discord.ActionRowBuilder().addComponents([new Discord.ButtonBuilder().setCustomId("accept").setEmoji("✅").setStyle("Secondary")])
let row2 = new Discord.ActionRowBuilder().addComponents([new Discord.ButtonBuilder().setCustomId("rock").setEmoji("👊").setStyle("Secondary"), new Discord.ButtonBuilder().setCustomId("paper").setEmoji("🖐️").setStyle("Secondary"), new Discord.ButtonBuilder().setCustomId("scissors").setEmoji("✌️").setStyle("Secondary")])
const m = await message.channel.send({ content: `**Rock Paper Scissors**\n${member.user.toString()}, ${message.author.toString()} invited you to play rps`, components: [row] })
if (member.id === '980029127178469407') {
await m.edit({ content: `**Rock Paper Scissors**\nwaiting...`, components: [row2] })
}
const col = m.createMessageComponentCollector({ filter, time: 75000 })
col.on('collect', async i => {
i.deferUpdate().catch(e => { })
if (i.customId === 'accept' && i.user.id === member.id) {
await m.edit({ content: `**Rock Paper Scissors**\nwaiting...`, components: [row2] })
} else if (i.customId !== 'accept') {
if (chosen[i.user.id]) return i.reply({ ephemeral: true, content: "You already chose -_-" })
chosen[i.user.id] = i.customId
m.edit(m.content.replace("waiting...", "") + "\n" + message.author.toString() + "has chosen")
if (member.id === '980029127178469407') {
let counter = 'rock'
if (chosen[message.author.id] === 'rock') counter = 'paper'
else if (chosen[message.author.id] === 'paper') counter = 'scissors'
else if (chosen[message.author.id] === 'scissors') counter = 'rock'
chosen[member.id] = counter
}
if (chosen[message.author.id] && chosen[member.id]) {
let winner = await check(message.author.toString(), chosen[message.author.id], member.user.toString(), chosen[member.id])
m.edit({ content: `**Rock Paper Scissors**\n${message.author.toString()} chose ${chosen[message.author.id]}\n${member.user.toString()} chose ${chosen[member.id]}\n\n${winner} won!`, components: [] })
}
}
})
}
//admin cmds
if (!['874550152474546176', '875660982289051698', '984746441002057755'].some(r => message.member.roles.cache.has(r)) && (message.author.id !== '833792409539444746')) return;
const chunk = (value, n) => {
let output = []
for (var i = 0; i < value.length; i += n) {
output.push(typeof value === 'string' ? value.substr(i, n) : value.slice(i, n + i))
}
return output
}
if (command === 'kick') {
let [member, ...reason] = args;
member = message.mentions.members.first() || await message.guild.members.cache.get(member)
if (!member) return message.reply("Member not found! mention or put id")
if (member.roles.highest.position >= message.member.roles.highest.position && message.guild.ownerID !== message.author.id) return message.reply({
embeds: [{
title: 'Role hierarchy',
description: 'You cannot ban a person who has a role above or equal to your highest role'
}]
})
member.kick()
message.reply("kicked " + member.toString())
} else if (command === 'ban') {
let [member, ...reason] = args;
member = message.mentions.members.first() || await message.guild.members.cache.get(member)
if (!member) return message.reply("Member not found! mention or put id")
if (member.roles.highest.position >= message.member.roles.highest.position && message.guild.ownerID !== message.author.id) return message.reply({
embeds: [{
title: 'Role hierarchy',
description: 'You cannot ban a person who has a role above or equal to your highest role'
}]
})
member.ban()
message.reply("banned " + member.toString())
}
if (command === 'create-self-roles') {
let steam = client.emojis.cache.get("980037076739293214").toString()
let mc = client.emojis.cache.get("980038950787874836").toString()
let valo = client.emojis.cache.get("980039213481357343").toString()
const row = new Discord.ActionRowBuilder().addComponents([new Discord.ButtonBuilder().setCustomId("1").setLabel("Platforms").setStyle("Primary").setEmoji(steam), new Discord.ButtonBuilder().setCustomId("2").setLabel("Events").setStyle("Primary").setEmoji(mc), new Discord.ButtonBuilder().setCustomId("3").setLabel("Game").setStyle("Primary").setEmoji(valo), new Discord.ButtonBuilder().setCustomId("4").setLabel("Verification").setStyle("Primary").setEmoji('✅')])
let m = await message.channel.send({ content: "Choose template: ", components: [row] })
let filter = i => i.user.id === message.author.id
let col = m.createMessageComponentCollector({ filter, time: 25000 })
col.on("collect", async i => {
if (i.customId === '1') {
i.reply("You chose platforms, creating self-roles message automatically...")
.then(m => setTimeout(() => { i.deleteReply() }, 3500))
const emb = new Discord.EmbedBuilder()
.setTitle("Which platform do you game on?")
.setDescription(`<:steam:980037076739293214>: @PC
<:xbox:980037131072327721>: @XBOX
<:playstation:980037170012254238>: @Playstation
<:switch:980037202396450817>: @Switch
<:mobile:980037285624041482>: @Mobile`)
let platforms = ['Steam', "Xbox", 'Playstation', 'Switch', 'Mobile']
const row2 = new Discord.ActionRowBuilder().addComponents(platforms.map(p => {
let name = p
let emoji = client.emojis.cache.find(e => e.name === name.toLowerCase())
console.log(p, emoji)
return new Discord.ButtonBuilder().setCustomId("role|" + message.guild.roles.cache.find(role => {
if (name === 'Steam') {
if (role.name === 'PC') return role
} else {
if (role.name.toLowerCase() === p.toLowerCase()) return role
}
}).id).setLabel(name).setEmoji(emoji?.toString()).setStyle("Primary")
}))
await message.channel.send({ embeds: [emb], components: [row2] })
} else if (i.customId === '2') {
i.reply("You chose events, creating self-roles message automatically...")
.then(m => setTimeout(() => { i.deleteReply() }, 3500))
const events = {
"3D": "984746440893026341",
"Gaming": "984746440893026335",
"Quiz and Crossword": "984746440893026340",
"dCrypt": "984746440893026342",
"GD": "984746440893026337",
"Photography": "984746440893026338",
"Audio Mixing": "984746440893026334",
"Film Making": "984746440893026343",
"Arduino": "984762016088612874",
"RoboWars": "984762042059735051",
"Web Development": "984746440893026339",
"Programming": "984746440867844115",
"Design": "984746440943370240",
"Minecraft": "984746440893026336"
}
const embed = new Discord.EmbedBuilder()
.setDescription(`Click on the buttons corresponding to your event to gain access to the respective channels.
To select, click on the buttons below this message.`)
.setAuthor({ name: "Event Selection", iconURL: client.user.displayAvatarURL() })
.setColor("#f50404")
const buttons = chunk((Object.keys(events).map(e => {
return new Discord.ButtonBuilder().setCustomId("role|" + events[e]).setLabel(e).setStyle('Secondary')
})), 5)
const rows = buttons.map(r => new Discord.ActionRowBuilder().addComponents(r))
message.channel.send({ embeds: [embed], components: rows })
} else if (i.customId === '3') {
i.reply("You chose games, creating self-roles message automatically...")
.then(m => setTimeout(() => { i.deleteReply() }, 3500))
const row4 = new Discord.ActionRowBuilder().addComponents([new Discord.ButtonBuilder().setCustomId("role|878696325133254716").setLabel("Gaming").setStyle("Danger").setEmoji(valo), new Discord.ButtonBuilder().setCustomId("role|877875583286136893").setLabel("Minecraft").setStyle("Success").setEmoji(mc)])
const emb = new Discord.EmbedBuilder()
.setTitle("Choose your game")
.setDescription(`<:valorant:980039213481357343>: Gaming
<:minecraft:980038950787874836>: Minecraft`)
message.channel.send({ embeds: [emb], components: [row4] })
} else if (i.customId === '4') {
const row5 = new Discord.ActionRowBuilder().addComponents([new Discord.ButtonBuilder().setCustomId("role|984746440867844114").setLabel("Verify").setStyle("Success").setEmoji('✅')])
i.reply("You chose verification, creating self-roles message automatically...").then(m => setTimeout(() => { i.deleteReply() }, 3500))
message.channel.send({ content: "Verify yourself here if you are a participant.", components: [row5] })
}
})
} else if (command === 'say') {
message.delete()
message.channel.send(args.join(" "))
} else if (command === 'announce') {
message.delete()
let emb = new Discord.EmbedBuilder()
.setTitle("Announcement")
.setDescription(args.join(" "))
.setColor("#fd0707")
.setFooter({ text: message.author.tag, iconURL: message.author.displayAvatarURL() })
message.channel.send({ embeds: [emb] })
} else if (command === 'yeet') {
message.channel.send("kicking " + args.join(" ") + "...")
.then(m => setTimeout(() => {
m.edit("✅ Kicked " + args.join(" ")).then(m => setTimeout(() => {
m.edit(m.content + "\nSike")
}, 3500))
}, 4000))
/* message.member.roles.add("980463364813766777")
setTimeout(() => {
message.member.roles.remove("980463364813766777")
}, 120000)*/
} else if (command === 'impersonate' || command === 'sudo') {
let [member, ...text] = args
text = text.join(" ")
message.delete()
member = message.mentions.members.first() || message.guild.members.cache.get(member)
const webhooks = await message.channel.fetchWebhooks()
const webhook = webhooks.first()
if (!webhook) {
message.channel.createWebhook(member.user.username, {
avatar: member.user.displayAvatarURL(),
})
.then(async (_webhook) => {
await _webhook.send(text)
})
} else {
await webhook.send({
content: text,
username: member.user?.username || member.username || '** **',
avatarURL: member.user.displayAvatarURL(),
})
}
} else if (command === 'eval' && message.author.id === '833792409539444746') {
message.delete()
const truncate = (string, length) => {
if (string.length > length)
return string.substring(0, length) + '...```';
else
return string;
}
let output = await eval(args.join(" "))
message.channel.send(truncate("```js\n" + output + "\n```", 1024))
}
})
client.on("interactionCreate", interaction => {
if (interaction.isChatInputCommand() || interaction.isAutocomplete()) {
let commandName = interaction.commandName
let args = interaction.options.data
if (interaction.isAutocomplete()) {
const currentValue = interaction.options.getFocused()
const optionName = interaction.options.getFocused(true).name
}
if (args && args.length >= 1) args = args.map(a => a.value || a).flat(Infinity).join(" ").split(" ")
else args = []
if (commandName === 'verify') {
let [ev, n] = interaction.options.data.map(a => a.value)
if (ev == 'Minecraft') return interaction.reply({ ephemeral: true, content: 'https://discord.gg/vVfNDTca' })
if (ev == 'dCrypt') return interaction.reply({ ephemeral: true, content: 'https://discord.gg/8KGWnZTBWN' })
interaction.user.send("**Verification Process**\nHey, verification also requires approval from your house warden.\nPlease send an image proof to get verified.").catch(e => {
interaction.channel.send(interaction.user.toString() + " I could not DM you for verification instructions, after fixing server privacy settings DM me with image proof that you are approved by house warden (ex- whatsapp msg)")
})
const check = new Discord.ActionRowBuilder().addComponents([new Discord.ButtonBuilder().setCustomId("check").setLabel("Verify and add as participant").setStyle("Secondary")])
return interaction.reply({ embeds: [new Discord.EmbedBuilder().setTitle("Verification for " + interaction.user.tag).setColor(272492).setDescription(interaction.user.toString() + "\nName: " + n + "\nEvent: " + ev + "\n*A mod/admin will verify and add your roles soon.*").setFooter({ text: interaction.user.id })], components: [check] })
}
} else if (interaction.isButton()) {
const id = interaction.customId
if (id === 'check') {
if (interaction.member.roles.cache.has("984746441002057755")) {
let id = interaction.message.embeds[0].footer.text
let mem = interaction.guild.members.cache.get(id)
if (!mem) return interaction.reply({ ephemeral: true, content: "I could not message this user as this message is too old, please message yourself" })
if (mem) {
mem.roles.add('984746440867844114')
mem.roles.remove('984746440867844113')
}
mem.send("You have been verified in nCrypt intra server!")
interaction.message.delete()
} else interaction.reply({ ephemeral: true, content: "You are not a mod!" })
}
if (id.startsWith("role|")) {
let roleId = id.replace("role|", "")
if (!interaction.member.roles.cache.has(roleId)) {
interaction.reply({ ephemeral: true, content: 'Added role!' })
interaction.member.roles.add(roleId, 'Role from self-claimable-roles')
}
else {
interaction.reply({ ephemeral: true, content: 'Removed role!' })
interaction.member.roles.remove(roleId, 'Role from self-claimable-roles')
}
}
}
})
client.on("ready", () => {
console.log("READY!")
})
process.on("uncaughtException", (err) => {
return console.error(`There was an uncaught error:\n${err.stack ?? err.toString()}`)
})
client.on('error', err => {
return console.log(err.stack)
})
client.login(token)