Converted main codebase to typescript
Signed-off-by: Taken <taken@mairimashita.org>
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
const { userMention } = require("discord.js")
|
||||
const { color, botLogChannel } = require("../../../../config/options.json")
|
||||
import { ChannelType, GuildMember, userMention } from "discord.js"
|
||||
import { color, botLogChannel } from "../../../../config/options.json"
|
||||
import { Event } from "../../../interfaces"
|
||||
|
||||
module.exports = {
|
||||
const event: Event = {
|
||||
name: "logNewJoins",
|
||||
description: "Logs new joins",
|
||||
type: "event",
|
||||
event: "guildMemberAdd",
|
||||
|
||||
/** @param { import('discord.js').GuildMember } member */
|
||||
execute(member) {
|
||||
execute(member: GuildMember) {
|
||||
|
||||
const channel = member.guild.channels.cache.get(botLogChannel)
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
@@ -18,6 +18,11 @@ module.exports = {
|
||||
return
|
||||
}
|
||||
|
||||
if (channel.type !== ChannelType.GuildText) {
|
||||
console.log("[ERROR] The channel used for new join logging is not a text channel.")
|
||||
return
|
||||
}
|
||||
|
||||
channel.send({
|
||||
embeds: [{
|
||||
title: "New Member",
|
||||
@@ -27,9 +32,11 @@ module.exports = {
|
||||
footer: {
|
||||
text: "ID: " + member.id
|
||||
},
|
||||
timestamp: new Date()
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export = event
|
||||
@@ -1,12 +1,13 @@
|
||||
module.exports = {
|
||||
import { ChatInputCommandInteraction, ButtonInteraction } from "discord.js"
|
||||
import { Event } from "../../../interfaces"
|
||||
|
||||
const event: Event = {
|
||||
name: "logBtnsCmds",
|
||||
description: "Logs all button and command interactions",
|
||||
type: "event",
|
||||
event: "interactionCreate",
|
||||
|
||||
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
|
||||
|
||||
execute(interaction) {
|
||||
execute(interaction: ChatInputCommandInteraction | ButtonInteraction) {
|
||||
if (interaction.isCommand()) {
|
||||
try {
|
||||
console.log(interaction.user.username + " ran " +
|
||||
@@ -18,11 +19,16 @@ module.exports = {
|
||||
interaction.commandName
|
||||
)
|
||||
}
|
||||
} else if (interaction.isButton()) {
|
||||
}
|
||||
|
||||
if (interaction.isButton()) {
|
||||
console.log(interaction.user.username + "#" +
|
||||
interaction.user.discriminator + " clicked " +
|
||||
interaction.customId
|
||||
)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export = event
|
||||
@@ -1,14 +1,17 @@
|
||||
module.exports = {
|
||||
import { Event } from "../../../interfaces"
|
||||
import { Message } from "discord.js"
|
||||
|
||||
const event: Event = {
|
||||
name: "ur mom",
|
||||
description: "ur moms someone",
|
||||
type: "event",
|
||||
event: "messageCreate",
|
||||
|
||||
/** @param { import('discord.js').Message } message */
|
||||
|
||||
async execute(message) {
|
||||
async execute(message: Message) {
|
||||
if (message.content.toLowerCase().includes("ur mom") && message.author.username === "taken.lua") {
|
||||
message.react("Woot:734345936347725885")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export = event
|
||||
@@ -1,11 +0,0 @@
|
||||
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 + "!")
|
||||
}
|
||||
}
|
||||
15
src/events/server/ready/consolelog.ts
Normal file
15
src/events/server/ready/consolelog.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Event } from "../../../interfaces"
|
||||
import { ExtendedClient as Client } from "../../../utils/Client"
|
||||
|
||||
const event: Event = {
|
||||
name: "conolelog",
|
||||
description: "console log",
|
||||
type: "event",
|
||||
event: "ready",
|
||||
|
||||
execute(client: Client) {
|
||||
console.log("Logged in as " + client.user!.tag + "!")
|
||||
}
|
||||
}
|
||||
|
||||
export = event
|
||||
@@ -1,12 +1,15 @@
|
||||
const { onlineLogChannel, color } = require("../../../../config/options.json")
|
||||
import { onlineLogChannel, color } from "../../../../config/options.json"
|
||||
import { Event } from "../../../interfaces"
|
||||
import { ExtendedClient as Client } from "../../../utils/Client"
|
||||
import { ChannelType } from "discord.js"
|
||||
|
||||
module.exports = {
|
||||
const event: Event = {
|
||||
name: "sendonlinemessage",
|
||||
description: "send an online message",
|
||||
type: "event",
|
||||
event: "ready",
|
||||
|
||||
execute(client) {
|
||||
execute(client: Client) {
|
||||
if (process.env.NODE_ENV === "dev") return
|
||||
|
||||
const channel = client.channels.cache.get(onlineLogChannel)
|
||||
@@ -17,6 +20,11 @@ module.exports = {
|
||||
return
|
||||
}
|
||||
|
||||
if (channel.type !== ChannelType.GuildText) {
|
||||
console.log("[ERROR] Online message channel is not a text channel.")
|
||||
return
|
||||
}
|
||||
|
||||
channel.send({
|
||||
embeds: [{
|
||||
description: "Bot is online!",
|
||||
@@ -25,3 +33,5 @@ module.exports = {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export = event
|
||||
@@ -1,14 +1,14 @@
|
||||
const statuses = require("../../../../config/statuses.json")
|
||||
import statuses = require("../../../../config/statuses.json")
|
||||
import { Event } from "../../../interfaces"
|
||||
import { ExtendedClient as Client } from "../../../utils/Client"
|
||||
|
||||
module.exports = {
|
||||
const event: Event = {
|
||||
name: "status",
|
||||
description: "Sets the status of the bot",
|
||||
type: "event",
|
||||
event: "ready",
|
||||
|
||||
/** @param { import('discord.js').Client } client */
|
||||
|
||||
execute(client) {
|
||||
execute(client: Client) {
|
||||
|
||||
// Playing 0
|
||||
// Streaming 1
|
||||
@@ -17,18 +17,22 @@ module.exports = {
|
||||
// Custom 4
|
||||
// Competing 5
|
||||
|
||||
client.user.setActivity(
|
||||
const user = client.user!
|
||||
|
||||
user.setActivity(
|
||||
{ name: statuses[0].name, type: statuses[0].type }
|
||||
)
|
||||
|
||||
let i = 1
|
||||
setInterval(() =>
|
||||
client.user.setActivity(
|
||||
statuses[i, i++ % statuses.length]
|
||||
user.setActivity(
|
||||
statuses[i++ % statuses.length]
|
||||
),
|
||||
1000 * 60 * 10
|
||||
)
|
||||
|
||||
client.user.setStatus("dnd")
|
||||
user.setStatus("dnd")
|
||||
}
|
||||
}
|
||||
|
||||
export = event
|
||||
@@ -1,20 +1,16 @@
|
||||
const { userMention, channelMention } = require("discord.js")
|
||||
const { botLogChannel, color } = require("../../../../config/options.json")
|
||||
import { userMention, channelMention, VoiceState, ChannelType } from "discord.js"
|
||||
import { botLogChannel, color } from "../../../../config/options.json"
|
||||
import { Event } from "../../../interfaces"
|
||||
|
||||
module.exports = {
|
||||
const event: Event = {
|
||||
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: VoiceState, newState: VoiceState) {
|
||||
|
||||
execute(oldState, newState) {
|
||||
|
||||
// if (process.env.NODE_ENV === 'dev') return
|
||||
if (process.env.NODE_ENV === 'dev') return
|
||||
|
||||
const guild = oldState.guild
|
||||
const channel = guild.channels.cache.get(botLogChannel)
|
||||
@@ -25,6 +21,11 @@ module.exports = {
|
||||
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
|
||||
|
||||
@@ -33,14 +34,14 @@ module.exports = {
|
||||
channel.send({
|
||||
embeds: [{
|
||||
title: "Voice Channel Join",
|
||||
description: userMention(oldState.member.id) +
|
||||
description: userMention(newState.member!.id) +
|
||||
" joined " +
|
||||
channelMention(newChannel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + oldState.member.id
|
||||
text: "ID: " + newState.member!.id
|
||||
},
|
||||
timestamp: new Date()
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
@@ -49,14 +50,14 @@ module.exports = {
|
||||
channel.send({
|
||||
embeds: [{
|
||||
title: "Voice Channel Leave",
|
||||
description: userMention(oldState.member.id) +
|
||||
description: userMention(oldState.member!.id) +
|
||||
" left " +
|
||||
channelMention(oldChannel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + oldState.member.id
|
||||
text: "ID: " + oldState.member!.id
|
||||
},
|
||||
timestamp: new Date()
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
@@ -67,16 +68,16 @@ module.exports = {
|
||||
channel.send({
|
||||
embeds: [{
|
||||
title: "Voice Channel Switch",
|
||||
description: userMention(oldState.member.id) +
|
||||
description: userMention(oldState.member!.id) +
|
||||
" switched from " +
|
||||
channelMention(oldChannel.id) +
|
||||
" to " +
|
||||
channelMention(newChannel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + oldState.member.id
|
||||
text: "ID: " + oldState.member!.id
|
||||
},
|
||||
timestamp: new Date()
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
@@ -84,3 +85,5 @@ module.exports = {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export = event
|
||||
Reference in New Issue
Block a user