mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 01:53:30 +01:00
Co-authored-by: Noel <icrawltogo@gmail.com> Co-authored-by: Amish Shah <dev@shah.gg> Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com> Co-authored-by: SynthGhost <60333233+synthghost@users.noreply.github.com> Co-authored-by: SpaceEEC <24881032+SpaceEEC@users.noreply.github.com> Co-authored-by: Elliot <elliot@maisl.fr> Co-authored-by: Antonio Román <kyradiscord@gmail.com> Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
24 lines
666 B
JavaScript
24 lines
666 B
JavaScript
'use strict';
|
|
|
|
const Action = require('./Action');
|
|
const { Events } = require('../../util/Constants');
|
|
|
|
class ThreadCreateAction extends Action {
|
|
handle(data) {
|
|
const client = this.client;
|
|
const existing = client.channels.cache.has(data.id);
|
|
const thread = client.channels.add(data);
|
|
if (!existing && thread) {
|
|
/**
|
|
* Emitted whenever a thread is created or when the client user is added to a thread.
|
|
* @event Client#threadCreate
|
|
* @param {ThreadChannel} thread The thread that was created
|
|
*/
|
|
client.emit(Events.THREAD_CREATE, thread);
|
|
}
|
|
return { thread };
|
|
}
|
|
}
|
|
|
|
module.exports = ThreadCreateAction;
|