-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiscordjs-cheatsheet.js
655 lines (577 loc) · 25.6 KB
/
discordjs-cheatsheet.js
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
// Discord all events!
// A quick and dirty fleshing out of the discord.js event listeners (not tested at all!)
// listed here -> https://discord.js.org/#/docs/main/stable/class/Client
// Learn from this, do not just copy it mofo!
//
// Saved to -> https://gist.github.com/koad/316b265a91d933fd1b62dddfcc3ff584
// Last Updated -> Halloween 2022
/*
koad-was-here
b25lIEdvZCwgb25lIGxvdmUu
*/
const Discord = require('discord.js');
const client = new Discord.Client();
const token = process.env.DISCORD_LOGIN_TOKEN | ""
var inviteLink = "";
// apiRequest
/* Emitted before every API request. This event can emit several times for the same request, e.g. when hitting a rate limit.
PARAMETER TYPE DESCRIPTION
request APIRequest The request that is about to be sent */
client.on("apiRequest", function(req){
console.log(`apiRequest: ${req}`);
});
// apiResponse
/* Emitted after every API request has received a response. This event does not necessarily correlate to completion of the request, e.g. when hitting a rate limit.
PARAMETER TYPE DESCRIPTION
request APIRequest The request that is about to be sent */
client.on("apiResponse", function(res){
console.log(`apiResponse: ${res}`);
});
// the previous, apiRequest and apiResponse, are informational events that are emitted quite frequently, it is highly recommended to check request.path to filter the data.
// channelCreate
/* Emitted whenever a channel is created.
PARAMETER TYPE DESCRIPTION
channel Channel The channel that was created */
client.on("channelCreate", function(channel){
console.log(`channelCreate: ${channel}`);
});
// channelDelete
/* Emitted whenever a channel is deleted.
PARAMETER TYPE DESCRIPTION
channel Channel The channel that was deleted */
client.on("channelDelete", function(channel){
console.log(`channelDelete: ${channel}`);
});
// channelPinsUpdate
/* Emitted whenever the pins of a channel are updated. Due to the nature of the WebSocket event, not much information can be provided easily here - you need to manually check the pins yourself.
PARAMETER TYPE DESCRIPTION
channel Channel The channel that the pins update occurred in
time Date The time of the pins update */
client.on("channelPinsUpdate", function(channel, time){
console.log(`channelPinsUpdate: ${channel}:${time}`);
});
// channelUpdate
/* Emitted whenever a channel is updated - e.g. name change, topic change.
PARAMETER TYPE DESCRIPTION
oldChannel Channel The channel before the update
newChannel Channel The channel after the update */
client.on("channelUpdate", function(oldChannel, newChannel){
console.log(`channelUpdate -> a channel is updated - e.g. name change, topic change`);
});
// debug
/* Emitted for general debugging information.
PARAMETER TYPE DESCRIPTION
info string The debug information */
client.on("debug", function(info){
console.log(`debug -> ${info}`);
});
// emojiCreate
/* Emitted whenever a custom emoji is created in a guild.
PARAMETER TYPE DESCRIPTION
emoji Emoji The emoji that was created */
client.on("emojiCreate", function(emoji){
console.log(`a custom emoji is created in a guild`);
});
// emojiDelete
/* Emitted whenever a custom guild emoji is deleted.
PARAMETER TYPE DESCRIPTION
emoji Emoji The emoji that was deleted */
client.on("emojiDelete", function(emoji){
console.log(`a custom guild emoji is deleted`);
});
// emojiUpdate
/* Emitted whenever a custom guild emoji is updated.
PARAMETER TYPE DESCRIPTION
oldEmoji Emoji The old emoji
newEmoji Emoji The new emoji */
client.on("emojiUpdate", function(oldEmoji, newEmoji){
console.log(`a custom guild emoji is updated`);
});
// error
/* Emitted whenever the client's WebSocket encounters a connection error.
PARAMETER TYPE DESCRIPTION
error Error The encountered error */
client.on("error", function(error){
console.error(`client's WebSocket encountered a connection error: ${error}`);
});
// guildBanAdd
/* Emitted whenever a member is banned from a guild.
PARAMETER TYPE DESCRIPTION
guild Guild The guild that the ban occurred in
user User The user that was banned */
client.on("guildBanAdd", function(guild, user){
console.log(`a member is banned from a guild`);
});
// guildBanRemove
/* Emitted whenever a member is unbanned from a guild.
PARAMETER TYPE DESCRIPTION
guild Guild The guild that the unban occurred in
user User The user that was unbanned */
client.on("guildBanRemove", function(guild, user){
console.log(`a member is unbanned from a guild`);
});
// guildCreate
/* Emitted whenever the client joins a guild.
PARAMETER TYPE DESCRIPTION
guild Guild The created guild */
client.on("guildCreate", function(guild){
console.log(`the client joins a guild`);
console.log({guild});
});
// guildDelete
/* Emitted whenever a guild is deleted/left.
PARAMETER TYPE DESCRIPTION
guild Guild The guild that was deleted */
client.on("guildDelete", function(guild){
console.log(`the client deleted/left a guild`);
console.log({guild});
});
// guildIntegrationsUpdate
/* Emitted whenever a guild integration is updated
PARAMETER TYPE DESCRIPTION
guild Guild The guild whose integrations were updated */
client.on("guildIntegrationsUpdate", function(guild){
console.log(`a guild integration is updated`);
console.log({guild});
});
// guildMemberAdd
/* Emitted whenever a user joins a guild.
PARAMETER TYPE DESCRIPTION
member GuildMember The member that has joined a guild */
client.on("guildMemberAdd", function(member){
console.log(`a user joins a guild: ${member.tag}`);
});
// guildMemberAvailable
/* Emitted whenever a member becomes available in a large guild.
PARAMETER TYPE DESCRIPTION
member GuildMember The member that became available */
client.on("guildMemberAvailable", function(member){
console.log(`member becomes available in a large guild: ${member.tag}`);
});
// guildMemberRemove
/* Emitted whenever a member leaves a guild, or is kicked.
PARAMETER TYPE DESCRIPTION
member GuildMember The member that has left/been kicked from the guild */
client.on("guildMemberRemove", function(member){
console.log(`a member leaves a guild, or is kicked: ${member.tag}`);
});
// guildMembersChunk
/* Emitted whenever a chunk of guild members is received (all members come from the same guild).
PARAMETER TYPE DESCRIPTION
members Array<GuildMember> The members in the chunk
guild Guild The guild related to the member chunk */
client.on("guildMembersChunk", function(members, guild, chunk){
console.log(`a chunk of guild members is received`);
console.log({members, guild, chunk});
});
// guildMemberUpdate
/* Emitted whenever a guild member changes - i.e. new role, removed role, nickname.
PARAMETER TYPE DESCRIPTION
oldMember GuildMember The member before the update
newMember GuildMember The member after the update */
client.on("guildMemberUpdate", function(oldMember, newMember){
console.log(`a guild member changes - i.e. new role, removed role, nickname.`);
console.log({oldMember, newMember});
});
// guildScheduledEventCreate
/* Emitted whenever a guild scheduled event is created.
PARAMETER TYPE DESCRIPTION
guildScheduledEvent GuildScheduledEvent The created guild scheduled event */
client.on("guildScheduledEventCreate", function(guildScheduledEvent){
console.log(`guild scheduled event is created.`);
console.log({guildScheduledEvent});
});
// guildScheduledEventDelete
/* Emitted whenever a guild scheduled event is deleted.
PARAMETER TYPE DESCRIPTION
guildScheduledEvent GuildScheduledEvent The deleted guild scheduled event */
client.on("guildScheduledEventDelete", function(guildScheduledEvent){
console.log(`a guild scheduled event is deleted`);
console.log({guildScheduledEvent});
});
// guildScheduledEventUpdate
/* Emitted whenever a guild scheduled event gets updated.
PARAMETER TYPE DESCRIPTION
oldGuildScheduledEvent ?GuildScheduledEvent The guild scheduled event object before the update
newGuildScheduledEvent GuildScheduledEvent The guild scheduled event object after the update */
client.on("guildScheduledEventUpdate", function(oldGuildScheduledEvent, newGuildScheduledEvent){
console.log(`guild scheduled event has been updated`);
console.log({oldGuildScheduledEvent, newGuildScheduledEvent});
});
// guildScheduledEventUserAdd
/* Emitted whenever a user subscribes to a guild scheduled event
PARAMETER TYPE DESCRIPTION
guildScheduledEvent GuildScheduledEvent The guild scheduled event
user User The user who subscribed */
client.on("guildScheduledEventUserAdd", function(guildScheduledEvent, user){
console.log(`a user subscribed to a guild scheduled event`);
console.log({guildScheduledEvent, user});
});
// guildScheduledEventUserRemove
/* Emitted whenever a user unsubscribes from a guild scheduled event
PARAMETER TYPE DESCRIPTION
guildScheduledEvent GuildScheduledEvent The guild scheduled event
user User The user who unsubscribed */
client.on("guildScheduledEventUserRemove", function(guildScheduledEvent, user){
console.log(`a user unsubscribed from a guild scheduled event`);
console.log({guildScheduledEvent, user});
});
// guildUnavailable
/* Emitted whenever a guild becomes unavailable, likely due to a server outage.
PARAMETER TYPE DESCRIPTION
guild Guild The guild that has become unavailable */
client.on("guildUnavailable", function(guild){
console.error(`a guild becomes unavailable, likely due to a server outage: ${guild}`);
});
// guildUpdate
/* Emitted whenever a guild is updated - e.g. name change.
PARAMETER TYPE DESCRIPTION
oldGuild Guild The guild before the update
newGuild Guild The guild after the update */
client.on("guildUpdate", function(oldGuild, newGuild){
console.log(`a guild is updated`);
});
// interaction
/* DEPRECATED - Use interactionCreate instead */
// interactionCreate
/* Emitted when an interaction is created.
PARAMETER TYPE DESCRIPTION
interaction Interaction The interaction which was created */
client.on("interactionCreate", function(interaction){
console.log(`an interaction has been created`);
console.log({interaction});
});
// invalidated
/* Emitted when the client's session becomes invalidated.
NOTICE: You are expected to handle closing the process gracefully and preventing a boot loop if you are listening to this event.
so, I'm not putting in an example because you really shouldn't be rolling your own graceful shutdown unless you are silly like me. */
// invalidRequestWarning
/* Emitted periodically when the process sends invalid requests to let users avoid the 10k invalid requests in 10 minutes threshold that causes a ban
PARAMETER TYPE DESCRIPTION
invalidRequestWarningData InvalidRequestWarningData Object containing the invalid request info */
client.on("invalidRequestWarning", function(invalidRequestWarningData){
console.error(`invalid requests have been noticed and may lead to a ban!`);
console.error({invalidRequestWarningData});
});
// inviteCreate
/* Emitted when an invite is created.
Permissions Required: MANAGE_GUILD permissions for the guild, or MANAGE_CHANNELS permissions for the channel.
PARAMETER TYPE DESCRIPTION
invite Invite The invite that was created */
client.on("inviteCreate", function(invite){
console.log(`An invite was created`);
console.log({invite});
});
// inviteDelete
/* Emitted when an invite is deleted.
Permissions Required: MANAGE_GUILD permissions for the guild, or MANAGE_CHANNELS permissions for the channel.
PARAMETER TYPE DESCRIPTION
invite Invite The invite that was deleted */
client.on("inviteDelete", function(invite){
console.log(`an invite was deleted`);
console.log({invite});
});
// message
/* DEPRECATED - Use messageCreate instead */
// messageCreate
/* Emitted whenever a message is created.
PARAMETER TYPE DESCRIPTION
message Message The created message */
client.on("messageCreate", function(message){
console.log(`a message was created`);
console.log({message});
});
// messageDelete
/* Emitted whenever a message is deleted.
PARAMETER TYPE DESCRIPTION
message Message The deleted message */
client.on("messageDelete", function(message){
console.log(`message is deleted -> ${message}`);
});
// messageDeleteBulk
/* Emitted whenever messages are deleted in bulk.
PARAMETER TYPE DESCRIPTION
messages Collection<Snowflake, Message> The deleted messages, mapped by their ID */
client.on("messageDeleteBulk", function(messages){
console.log(`messages are deleted -> ${messages}`);
});
// messageReactionAdd
/* Emitted whenever a reaction is added to a message.
PARAMETER TYPE DESCRIPTION
messageReaction MessageReaction The reaction object
user User The user that applied the emoji or reaction emoji */
client.on("messageReactionAdd", function(messageReaction, user){
console.log(`a reaction is added to a message`);
});
// messageReactionRemove
/* Emitted whenever a reaction is removed from a message.
PARAMETER TYPE DESCRIPTION
messageReaction MessageReaction The reaction object
user User The user that removed the emoji or reaction emoji */
client.on("messageReactionRemove", function(messageReaction, user){
console.log(`a reaction is removed from a message`);
});
// messageReactionRemoveAll
/* Emitted whenever all reactions are removed from a message.
PARAMETER TYPE DESCRIPTION
message Message The message the reactions were removed from */
client.on("messageReactionRemoveAll", function(message){
console.log(`all reactions are removed from a message`);
});
// messageReactionRemoveEmoji
/* Emitted when a bot removes an emoji reaction from a cached message.
PARAMETER TYPE DESCRIPTION
reaction MessageReaction The reaction that was removed */
client.on("messageReactionRemoveEmoji", function(reaction){
console.log(`A reaction emoji was removed`);
console.log({reaction});
});
// messageUpdate
/* Emitted whenever a message is updated - e.g. embed or content change.
PARAMETER TYPE DESCRIPTION
oldMessage Message The message before the update
newMessage Message The message after the update */
client.on("messageUpdate", function(oldMessage, newMessage){
console.log(`a message is updated`);
});
// presenceUpdate
/* Emitted whenever a guild member's presence changes, or they change one of their details.
PARAMETER TYPE DESCRIPTION
oldMember GuildMember The member before the presence update
newMember GuildMember The member after the presence update */
client.on("presenceUpdate", function(oldMember, newMember){
console.log(`a guild member's presence changes`);
});
// rateLimit
/* Emitted when the client hits a rate limit while making a request
PARAMETER TYPE DESCRIPTION
rateLimitData RateLimitData Object containing the rate limit info */
client.on("rateLimit", function(rateLimitData){
console.log(`the rate limit has been hit! Slow'r down a tad.`);
console.log({rateLimitData});
});
// ready
/* Emitted when the client becomes ready to start working. */
client.on("ready", function(){
console.log(`the client becomes ready to start`);
console.log(`I am ready! Logged in as ${client.user.tag}!`);
console.log(`Bot has started, with ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`);
client.user.setActivity("the upright organ");
client.generateInvite(['SEND_MESSAGES', 'MANAGE_GUILD', 'MENTION_EVERYONE'])
.then(link => {
console.log(`Generated bot invite link: ${link}`);
inviteLink = link;
});
});
// roleCreate
/* Emitted whenever a role is created.
PARAMETER TYPE DESCRIPTION
role Role The role that was created */
client.on("roleCreate", function(role){
console.log(`a role is created`);
});
// roleDelete
/* Emitted whenever a guild role is deleted.
PARAMETER TYPE DESCRIPTION
role Role The role that was deleted */
client.on("roleDelete", function(role){
console.log(`a guild role is deleted`);
});
// roleUpdate
/* Emitted whenever a guild role is updated.
PARAMETER TYPE DESCRIPTION
oldRole Role The role before the update
newRole Role The role after the update */
client.on("roleUpdate", function(oldRole, newRole){
console.log(`a guild role is updated`);
});
// shardDisconnect
/* Emitted when a shard's WebSocket disconnects and will no longer reconnect.
PARAMETER TYPE DESCRIPTION
event CloseEvent The WebSocket close event
id number The shard id that disconnected */
client.on("shardDisconnect", function(event, id){
console.log(`shard with id ${id} has disconnected`);
console.log({event, id});
});
// shardError
/* Emitted whenever a shard's WebSocket encounters a connection error.
PARAMETER TYPE DESCRIPTION
error Error The encountered error
shardId number The shard that encountered this error */
client.on("shardError", function(error, shardId){
console.error(`a shard encountered a connection error`);
console.error({error, shardId});
});
// shardReady
/* Emitted when a shard turns ready.
PARAMETER TYPE DESCRIPTION
id number The shard id that turned ready
unavailableGuilds ?Set <Snowflake> Set of unavailable guild ids, if any */
client.on("shardReady", function(id, unavailableGuilds){
console.log(`a shard turned ready`);
console.log({id, unavailableGuilds});
});
// shardReconnecting
/* Emitted when a shard is attempting to reconnect or re-identify.
PARAMETER TYPE DESCRIPTION
id number The shard id that is attempting to reconnect */
client.on("shardReconnecting", function(id){
console.log(`a shard with id ${id} is attempting to reconnect or re-identify`);
console.log({id});
});
// shardResume
/* Emitted when a shard resumes successfully.
PARAMETER TYPE DESCRIPTION
id number The shard id that resumed
replayedEvents number The amount of replayed events */
client.on("shardResume", function(id, replayedEvents){
console.log(`a shard resumes successfully`);
console.log({id, replayedEvents});
});
// stageInstanceCreate
/* Emitted whenever a stage instance is created.
PARAMETER TYPE DESCRIPTION
stageInstance StageInstance The created stage instance */
client.on("stageInstanceCreate", function(stageInstance){
console.log(`a stage instance was created`);
console.log({stageInstance});
});
// stageInstanceDelete
/* Emitted whenever a stage instance is deleted.
PARAMETER TYPE DESCRIPTION
stageInstance StageInstance The deleted stage instance */
client.on("stageInstanceDelete", function(stageInstance){
console.log(`a stage instance is deleted`);
console.log({stageInstance});
});
// stageInstanceUpdate
/* Emitted whenever a stage instance gets updated - e.g. change in topic or privacy level
PARAMETER TYPE DESCRIPTION
oldStageInstance ?StageInstance The stage instance before the update
newStageInstance StageInstance The stage instance after the update */
client.on("stageInstanceUpdate", function(oldStageInstance, newStageInstance){
console.log(`stage instance has changed in topic or privacy level`);
console.log({oldStageInstance, newStageInstance});
});
// stickerCreate
/* Emitted whenever a custom sticker is created in a guild.
PARAMETER TYPE DESCRIPTION
sticker Sticker The sticker that was created */
client.on("stickerCreate", function(sticker){
console.log(`a custom sticker is created`);
console.log({sticker});
});
// stickerDelete
/* Emitted whenever a custom sticker is deleted in a guild.
PARAMETER TYPE DESCRIPTION
sticker Sticker The sticker that was deleted */
client.on("stickerDelete", function(sticker){
console.log(`a custom sticker is deleted`);
console.log({sticker});
});
// stickerUpdate
/* Emitted whenever a custom sticker is updated in a guild.
PARAMETER TYPE DESCRIPTION
oldSticker Sticker The old sticker
newSticker Sticker The new sticker */
client.on("stickerUpdate", function(oldSticker, newSticker){
console.log(`a custom sticker is updated`);
console.log({oldSticker, newSticker});
});
// threadCreate
/* Emitted whenever a thread is created or when the client user is added to a thread.
PARAMETER TYPE DESCRIPTION
thread ThreadChannel The thread that was created
newlyCreated boolean Whether the thread was newly created */
client.on("threadCreate", function(thread, newlyCreated){
console.log(`a thread has been created or the client user is added to an existing thread.`);
console.log({thread, newlyCreated});
});
// threadDelete
/* Emitted whenever a thread is deleted.
PARAMETER TYPE DESCRIPTION
thread ThreadChannel The thread that was deleted */
client.on("threadDelete", function(thread){
console.log(`a thread was deleted`);
console.log({thread});
});
// threadListSync
/* Emitted whenever the client user gains access to a text or news channel that contains threads
PARAMETER TYPE DESCRIPTION
threads Collection <Snowflake, ThreadChannel> The threads that were synced */
client.on("threadListSync", function(threads){
console.log(`the client user gains access to a text or news channel that contains threads`);
console.log({threads});
});
// threadMembersUpdate
/* Emitted whenever members are added or removed from a thread.
Permissions Required: GUILD_MEMBERS privileged intent
PARAMETER TYPE DESCRIPTION
oldMembers Collection <Snowflake, ThreadMember> The members before the update
newMembers Collection <Snowflake, ThreadMember> The members after the update */
client.on("threadMembersUpdate", function(oldMembers, newMembers){
console.log(`members are added or removed from a thread`);
console.log({oldMembers, newMembers});
});
// threadMemberUpdate
/* Emitted whenever the client user's thread member is updated.
PARAMETER TYPE DESCRIPTION
oldMember ThreadMember The member before the update
newMember ThreadMember The member after the update */
client.on("threadMemberUpdate", function(oldMember, newMember){
console.log(`the client user's thread member is updated`);
console.log({oldMember, newMember});
});
// threadUpdate
/* Emitted whenever a thread is updated - e.g. name change, archive state change, locked state change.
PARAMETER TYPE DESCRIPTION
oldThread ThreadChannel The thread before the update
newThread ThreadChannel The thread after the update */
client.on("threadUpdate", function(oldThread, newThread){
console.log(`thread is updated - e.g. name change, archive state change, locked state change.`);
console.log({oldThread, newThread});
});
// typingStart
/* Emitted whenever a user starts typing in a channel.
PARAMETER TYPE DESCRIPTION
channel Channel The channel the user started typing in
user User The user that started typing */
client.on("typingStart", function(channel, user){
console.log(`${user.tag} has started typing`);
});
// userUpdate
/* Emitted whenever a user's details (e.g. username) are changed.
PARAMETER TYPE DESCRIPTION
oldUser User The user before the update
newUser User The user after the update */
client.on("userUpdate", function(oldUser, newUser){
console.log(`user's details (e.g. username) are changed`);
});
// voiceStateUpdate
/* Emitted whenever a user changes voice state - e.g. joins/leaves a channel, mutes/unmutes.
PARAMETER TYPE DESCRIPTION
oldMember GuildMember The member before the voice state update
newMember GuildMember The member after the voice state update */
client.on("voiceStateUpdate", function(oldMember, newMember){
console.log(`a user changes voice state`);
});
// warn
/* Emitted for general warnings.
PARAMETER TYPE DESCRIPTION
info string The warning */
client.on("warn", function(info){
console.warn(`a general warning has been emitted`);
console.warn({info});
});
// webhookUpdate
/* Emitted whenever a channel has its webhooks changed.
PARAMETER TYPE DESCRIPTION
channel TextChannel The channel that had a webhook update
NewsChannel
VoiceChannel */
client.on("webhookUpdate", function(channel){
console.warn(`a channel's webhooks have changed`);
console.warn({channel});
});
client.login(token);