Added logtochannel function and moved to it
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { ChannelType, GuildMember, userMention } from "discord.js"
|
||||
import { color, botLogChannel } from "../../../../config/options.json"
|
||||
import { GuildMember, userMention } from "discord.js"
|
||||
import { color } from "../../../../config/options.json"
|
||||
import { Event } from "../../../interfaces"
|
||||
import logToChannel from "../../../utils/functions/logtochannel"
|
||||
|
||||
export = {
|
||||
name: "logNewJoins",
|
||||
@@ -9,24 +10,9 @@ export = {
|
||||
event: "guildMemberAdd",
|
||||
|
||||
execute(member: GuildMember) {
|
||||
const channel = member.guild.channels.cache.get(botLogChannel)
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
if (!channel) {
|
||||
console.log(
|
||||
"[ERROR] Could not find channel used for new join logging.",
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (channel.type !== ChannelType.GuildText) {
|
||||
console.log(
|
||||
"[ERROR] The channel used for new join logging is not a text channel.",
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
channel.send({
|
||||
logToChannel("bot", {
|
||||
embeds: [
|
||||
{
|
||||
title: "New Member",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { onlineLogChannel, color } from "../../../../config/options.json"
|
||||
import logToChannel from "../../../utils/functions/logtochannel"
|
||||
import { Event } from "../../../interfaces"
|
||||
import { ExtendedClient as Client } from "../../../utils/Client"
|
||||
import { ChannelType } from "discord.js"
|
||||
import { color } from "../../../../config/options.json"
|
||||
|
||||
export = {
|
||||
name: "sendonlinemessage",
|
||||
@@ -9,25 +8,12 @@ export = {
|
||||
type: "event",
|
||||
event: "ready",
|
||||
|
||||
execute(client: Client) {
|
||||
execute() {
|
||||
if (process.env.NODE_ENV === "dev") return
|
||||
|
||||
const channel = client.channels.cache.get(onlineLogChannel)
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
if (!channel) {
|
||||
console.log(
|
||||
"[ERROR] Could not find channel used for online message.",
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (channel.type !== ChannelType.GuildText) {
|
||||
console.log("[ERROR] Online message channel is not a text channel.")
|
||||
return
|
||||
}
|
||||
|
||||
channel.send({
|
||||
logToChannel("online", {
|
||||
embeds: [
|
||||
{
|
||||
description: "Bot is online!",
|
||||
|
||||
@@ -2,10 +2,10 @@ import {
|
||||
userMention,
|
||||
channelMention,
|
||||
VoiceState,
|
||||
ChannelType,
|
||||
} from "discord.js"
|
||||
import { botLogChannel, color } from "../../../../config/options.json"
|
||||
import { color } from "../../../../config/options.json"
|
||||
import { Event } from "../../../interfaces"
|
||||
import logToChannel from "../../../utils/functions/logtochannel"
|
||||
|
||||
export = {
|
||||
name: "vcJoinLeave",
|
||||
@@ -16,29 +16,12 @@ export = {
|
||||
execute(oldState: VoiceState, newState: VoiceState) {
|
||||
if (process.env.NODE_ENV === "dev") return
|
||||
|
||||
const guild = oldState.guild
|
||||
const channel = guild.channels.cache.get(botLogChannel)
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
if (!channel) {
|
||||
console.log(
|
||||
"[ERROR] Could not find channel used for voice channel join/leave logging.",
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (channel.type !== ChannelType.GuildText) {
|
||||
console.log(
|
||||
"[ERROR] The channel used for voice channel join/leave logging is not a text channel.",
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
const oldChannel = oldState.channel
|
||||
const newChannel = newState.channel
|
||||
|
||||
if (oldChannel === null && newChannel !== null) {
|
||||
channel.send({
|
||||
logToChannel("bot", {
|
||||
embeds: [
|
||||
{
|
||||
title: "Voice Channel Join",
|
||||
@@ -55,7 +38,7 @@ export = {
|
||||
],
|
||||
})
|
||||
} else if (oldChannel !== null && newChannel === null) {
|
||||
channel.send({
|
||||
logToChannel("bot", {
|
||||
embeds: [
|
||||
{
|
||||
title: "Voice Channel Leave",
|
||||
@@ -74,7 +57,7 @@ export = {
|
||||
} else if (oldChannel !== null && newChannel !== null) {
|
||||
if (oldChannel.id === newChannel.id) return
|
||||
|
||||
channel.send({
|
||||
logToChannel("bot", {
|
||||
embeds: [
|
||||
{
|
||||
title: "Voice Channel Switch",
|
||||
|
||||
Reference in New Issue
Block a user