Skip to content

Commit

Permalink
feat: ticket message on leave
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlauer-Hax committed Sep 8, 2023
1 parent 0fb46a7 commit 6f248d9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions helper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, TextChannel, GuildBan, GuildMember, PartialGuildMember, User, Message, VoiceState, EmbedBuilder } from 'npm:discord.js'
import { Client, TextChannel, GuildBan, GuildMember, PartialGuildMember, User, Message, VoiceState, EmbedBuilder, GuildTextBasedChannel } from 'npm:discord.js'

export function sendBanMessage(ban: GuildBan, banned: boolean) {
ban.client.channels.fetch(Deno.env.get("LOG_CHANNEL")!).then(channel => {
Expand All @@ -11,7 +11,8 @@ export function sendBanMessage(ban: GuildBan, banned: boolean) {
export function sendLeaveMessage(member: PartialGuildMember | GuildMember) {
const embed = defaultEmbed(member.user);
embed.setTitle(`${embed.data.title} left`)
member.guild.channels.fetch(Deno.env.get("LOG_CHANNEL")!).then(channel => (channel as TextChannel).send({ embeds: [ embed ] }))
member.guild.channels.fetch(Deno.env.get("LOG_CHANNEL")!).then(channel => (channel as TextChannel).send({ embeds: [ embed ] }));
member.guild.channels.fetch().then(channels => channels.filter(channel => channel?.isTextBased() && channel.name === "ticket-"+member.user.id).forEach(channel => (channel as GuildTextBasedChannel).send({ embeds: [ embed ] })));
}
export function sendPrivateMessage(message: Message, client: Client) {
if (message.channel.isDMBased()) {
Expand Down

0 comments on commit 6f248d9

Please sign in to comment.