Merge branch 'dev' into 'main'
Small tweak See merge request illegitimate/illegitimate-bot!170
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
"guildLogChannel": "1183733282534326322",
|
||||
"errorLogChannel": "1192476369850994788",
|
||||
"moderationLogChannel": "1193329771795447818",
|
||||
"devLogChannel": "1193688673632391280",
|
||||
"waitingListChannel": "1145773618291298384",
|
||||
"waitingListMessage": "1146027645415473193",
|
||||
"instructionsgif": "https://cdn.discordapp.com/attachments/838716950723952640/1188211176300089384/4DMu513uNxbM.gif?ex=6599b2e4&is=65873de4&hm=e727c7a39aacbc47d6a5453f4b5f792a45679983c30d662cd258a311381b6df0&"
|
||||
|
||||
@@ -10,6 +10,7 @@ export = {
|
||||
event: "guildMemberAdd",
|
||||
|
||||
execute(member: GuildMember) {
|
||||
if (process.env.NODE_ENV === "dev") return
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
logToChannel("bot", {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { guildid, onlineLogChannel, botLogChannel, guildLogChannel, errorLogChannel, moderationLogChannel } from "../../../config/options.json"
|
||||
import { guildid, onlineLogChannel, botLogChannel, guildLogChannel, errorLogChannel, moderationLogChannel, devLogChannel } from "../../../config/options.json"
|
||||
import { Guild, MessageCreateOptions, TextChannel } from "discord.js"
|
||||
import Illegitimate from "../Illegitimate"
|
||||
|
||||
@@ -7,15 +7,22 @@ const channels = {
|
||||
bot: botLogChannel,
|
||||
guild: guildLogChannel,
|
||||
error: errorLogChannel,
|
||||
mod: moderationLogChannel
|
||||
mod: moderationLogChannel,
|
||||
dev: devLogChannel
|
||||
}
|
||||
|
||||
type Channel = keyof typeof channels
|
||||
|
||||
export default async function logToChannel(channel: Channel, message: MessageCreateOptions): Promise<void|null> {
|
||||
const guild = Illegitimate.client.guilds.cache.get(guildid) as Guild
|
||||
let logChannel: TextChannel
|
||||
|
||||
if (process.env.NODE_ENV === "dev") {
|
||||
logChannel = guild.channels.cache.get(channels["dev"]) as TextChannel
|
||||
} else {
|
||||
logChannel = guild.channels.cache.get(channels[channel]) as TextChannel
|
||||
}
|
||||
|
||||
const logChannel = guild.channels.cache.get(channels[channel]) as TextChannel
|
||||
if (!logChannel) {
|
||||
console.log(`[ERROR] Could not find channel used for ${channel} logging.`)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user