diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-13 13:03:18 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-13 13:03:18 +0200 |
commit | a687b489d745c52e207637b6595edcb3eabe8f2d (patch) | |
tree | 98d45b035c2c9589d9702a9a2f442b62f9a3ab99 /api/src/util/Channel.ts | |
parent | Fix naming (diff) | |
parent | abstract Event emission (diff) | |
download | server-a687b489d745c52e207637b6595edcb3eabe8f2d.tar.xz |
Merge branch 'master' into pr/darkhpp/261-2
Diffstat (limited to 'api/src/util/Channel.ts')
-rw-r--r-- | api/src/util/Channel.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/api/src/util/Channel.ts b/api/src/util/Channel.ts index 4d322812..ef04d521 100644 --- a/api/src/util/Channel.ts +++ b/api/src/util/Channel.ts @@ -2,18 +2,18 @@ import { ChannelCreateEvent, ChannelModel, ChannelType, + emitEvent, getPermission, GuildModel, Snowflake, TextChannel, + toObject, VoiceChannel -} from "@fosscord/server-util"; +} from "@fosscord/util"; import { HTTPError } from "lambert-server"; -import { emitEvent } from "./Event"; // TODO: DM channel export async function createChannel(channel: Partial<TextChannel | VoiceChannel>, user_id: string = "0") { - // Always check if user has permission first const permissions = await getPermission(user_id, channel.guild_id); permissions.hasThrow("MANAGE_CHANNELS"); @@ -50,7 +50,7 @@ export async function createChannel(channel: Partial<TextChannel | VoiceChannel> recipient_ids: null }).save(); - await emitEvent({ event: "CHANNEL_CREATE", data: channel, guild_id: channel.guild_id } as ChannelCreateEvent); + await emitEvent({ event: "CHANNEL_CREATE", data: toObject(channel), guild_id: channel.guild_id } as ChannelCreateEvent); return channel; } |