Moved code to src folder

This commit is contained in:
2023-11-23 12:38:55 +01:00
parent 932bce6057
commit 0eeb48b2dd
68 changed files with 59 additions and 70 deletions

View File

@@ -0,0 +1,35 @@
const { userMention } = require("discord.js")
const { color, botLogChannel } = require("../../../../config/options.json")
module.exports = {
name: "logNewJoins",
description: "Logs new joins",
type: "event",
event: "guildMemberAdd",
/** @param { import('discord.js').GuildMember } member */
execute(member) {
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
}
channel.send({
embeds: [{
title: "New Member",
description: userMention(member.id) + " has joined the server.\n" +
"Account created: " + member.user.createdAt.toLocaleString(),
color: embedColor,
footer: {
text: "ID: " + member.id
},
timestamp: new Date()
}]
})
}
}

View File

@@ -0,0 +1,22 @@
module.exports = {
name: "logBtnsCmds",
description: "Logs all button and command interactions",
type: "event",
event: "interactionCreate",
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
execute(interaction) {
if (interaction.isCommand()) {
console.log(interaction.user.username + "#" +
interaction.user.discriminator + " ran " +
interaction.commandName
)
} else if (interaction.isButton()) {
console.log(interaction.user.username + "#" +
interaction.user.discriminator + " clicked " +
interaction.customId
)
}
}
}

View File

@@ -0,0 +1,14 @@
module.exports = {
name: "ur mom",
description: "ur moms someone",
type: "event",
event: "messageCreate",
/** @param { import('discord.js').Message } message */
async execute(message) {
if (message.content.toLowerCase().includes("ur mom") && message.author.username === "taken.lua") {
message.react("Woot:734345936347725885")
}
}
}

View File

@@ -0,0 +1,11 @@
module.exports = {
name: "conolelog",
description: "console log",
type: "event",
event: "ready",
/** @param { import('discord.js').Client } client */
execute(client) {
console.log("Logged in as " + client.user.tag + "!")
}
}

View File

@@ -0,0 +1,27 @@
const { onlineLogChannel, color } = require("../../../../config/options.json")
module.exports = {
name: "sendonlinemessage",
description: "send an online message",
type: "event",
event: "ready",
execute(client) {
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
}
channel.send({
embeds: [{
description: "Bot is online!",
color: embedColor
}]
})
}
}

View File

@@ -0,0 +1,34 @@
const statuses = require("../../../../config/statuses.json")
module.exports = {
name: "status",
description: "Sets the status of the bot",
type: "event",
event: "ready",
/** @param { import('discord.js').Client } client */
execute(client) {
// Playing 0
// Streaming 1
// Listening 2
// Watching 3
// Custom 4
// Competing 5
client.user.setActivity(
{ name: statuses[0].name, type: 3}
)
let i = 0
setInterval(() =>
client.user.setActivity(
statuses[i = 1, i++ % statuses.length]
),
1000 * 60 * 10
)
client.user.setStatus("dnd")
}
}

View File

@@ -0,0 +1,86 @@
const { userMention, channelMention } = require("discord.js")
const { botLogChannel, color } = require("../../../../config/options.json")
module.exports = {
name: "vcJoinLeave",
description: "Logs when a user joins or leaves a voice channel.",
type: "event",
event: "voiceStateUpdate",
/**
* @param { import('discord.js').VoiceState } oldState
* @param { import('discord.js').VoiceState } newState
*/
execute(oldState, newState) {
// 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
}
const oldChannel = oldState.channel
const newChannel = newState.channel
if (oldChannel === null && newChannel !== null) {
channel.send({
embeds: [{
title: "Voice Channel Join",
description: userMention(oldState.member.id) +
" joined " +
channelMention(newChannel.id),
color: embedColor,
footer: {
text: "ID: " + oldState.member.id
},
timestamp: new Date()
}]
})
} else if (oldChannel !== null && newChannel === null) {
channel.send({
embeds: [{
title: "Voice Channel Leave",
description: userMention(oldState.member.id) +
" left " +
channelMention(oldChannel.id),
color: embedColor,
footer: {
text: "ID: " + oldState.member.id
},
timestamp: new Date()
}]
})
} else if (oldChannel !== null && newChannel !== null) {
if (oldChannel.id === newChannel.id) return
channel.send({
embeds: [{
title: "Voice Channel Switch",
description: userMention(oldState.member.id) +
" switched from " +
channelMention(oldChannel.id) +
" to " +
channelMention(newChannel.id),
color: embedColor,
footer: {
text: "ID: " + oldState.member.id
},
timestamp: new Date()
}]
})
}
}
}