1 |
import { roleMention } from '@discordjs/builders'; |
import { roleMention } from '@discordjs/builders'; |
2 |
import { BanOptions, CommandInteraction, FileOptions, Guild, GuildBan, GuildMember, Message, MessageEmbed, TextChannel, User } from 'discord.js'; |
import { BanOptions, CommandInteraction, FileOptions, Guild, GuildBan, GuildMember, Message, MessageEmbed, MessageOptions, MessagePayload, TextChannel, User } from 'discord.js'; |
3 |
import ms from 'ms'; |
import ms from 'ms'; |
4 |
import DiscordClient from '../client/Client'; |
import DiscordClient from '../client/Client'; |
5 |
import Punishment from '../models/Punishment'; |
import Punishment from '../models/Punishment'; |
30 |
} |
} |
31 |
} |
} |
32 |
|
|
33 |
|
async send(guild: Guild, messageOptions: MessageOptions | MessagePayload | string) { |
34 |
|
let channelID = this.client.config.props[guild!.id].logging_channel; |
35 |
|
let channel = guild!.channels.cache.find((c: any) => c.id === channelID) as TextChannel; |
36 |
|
|
37 |
|
if (channel) { |
38 |
|
return await channel.send(messageOptions); |
39 |
|
} |
40 |
|
} |
41 |
|
|
42 |
|
log(guild: Guild, callback: (channel: TextChannel) => any) { |
43 |
|
this.channel(callback, { guild }); |
44 |
|
} |
45 |
|
|
46 |
logEdit(oldMsg: Message, newMsg: Message) { |
logEdit(oldMsg: Message, newMsg: Message) { |
47 |
this.channel(async (channel) => { |
this.channel(async (channel) => { |
48 |
await channel.send({ |
await channel.send({ |