first commit

This commit is contained in:
2025-06-21 15:13:58 -05:00
commit 07f75bbd93
37 changed files with 3125 additions and 0 deletions

View File

@ -0,0 +1,46 @@
const {
Client,
Interaction,
ApplicationCommandOptionType,
PermissionFlagsBits,
SlashCommandBuilder,
} = require("discord.js");
const db = require("../../db");
module.exports = {
data: new SlashCommandBuilder()
.setName("autowelcome")
.setDescription("Enable or disable auto-welcome messages.")
.addChannelOption((option) =>
option
.setName("channel")
.setDescription(
"Channel Id to send welcome messages (required when enabling)"
)
.setRequired(false)
)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async execute(interaction) {
const channelId = interaction.options.getChannel("channel");
const guildId = interaction.guild.id;
if (channelId) {
await db.query(
`INSERT INTO auto_welcome (guild_id, channel_id, enabled)
VALUES ($1, $2, $3)
ON CONFLICT (guild_id) DO UPDATE SET channel_id = $2, enabled = $3`,
[guildId, channelId.id, true]
);
return interaction.reply(
`Auto-welcome enabled! Messages will be sent to <#${channelId.id}>.`
);
} else {
await db.query(
`UPDATE auto_welcome SET enabled = $1 WHERE guild_id = $2`,
[false, guildId]
);
return interaction.reply("Auto-welcome has been disabled.");
}
},
};

17
commands/utility/ping.js Normal file
View File

@ -0,0 +1,17 @@
const { SlashCommandBuilder } = require("discord.js");
module.exports = {
data: new SlashCommandBuilder()
.setName("ping")
.setDescription("Replies with Pong! and websocket ping"),
async execute(interaction) {
// Send the initial reply and wait for it to be sent
const reply = await interaction.reply({
content: "Pong!",
fetchReply: true // This ensures we can get the reply object
});
const ping = reply.createdTimestamp - interaction.createdTimestamp; // Calculate the ping
await interaction.editReply(`Pong! client ${ping}ms | websocket: ${interaction.client.ws.ping}ms`);
},
};

View File

@ -0,0 +1,33 @@
const { Client, Interaction, ApplicationCommandOptionType, PermissionFlagsBits, SlashCommandBuilder } = require("discord.js");
const db = require("../../db");
module.exports = {
data: new SlashCommandBuilder()
.setName("setbluchannel")
.setDescription("Set the channel for Blu to send messages.")
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("Channel to set for Blu messages")
.setRequired(true)
)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async execute(interaction) {
const channelId = interaction.options.getChannel("channel");
const guildId = interaction.guild.id;
const guildName = interaction.guild.name;
const channelName = channelId.name;
if (channelId) {
await db.query(
`INSERT INTO bot_channel (guild_id, channel_id, guild_name, channel_name)
VALUES ($1, $2, $3, $4)
ON CONFLICT (guild_id) DO UPDATE SET Channel_id = $2, guild_name = $3, channel_name = $4`,
[guildId, channelId.id, guildName, channelName]
);
return interaction.reply(`Blu messages will be sent to <#${channelId.id}>.`);
} else {
return interaction.reply("Please provide a valid channel.");
}
},
}