Skip to content

Commit

Permalink
all: idk
Browse files Browse the repository at this point in the history
  • Loading branch information
jbcarreon123 committed Feb 20, 2024
1 parent 823d932 commit 8f2f38e
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 9 deletions.
12 changes: 12 additions & 0 deletions src/bot/components/buttons/test-button.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { ButtonBuilder, ButtonStyle, Interaction } = require("discord.js");
const config = require("../../config.ts");

module.exports = {
button: new ButtonBuilder()
.setLabel("Poke")
.setCustomId("test-button")
.setStyle(ButtonStyle),
async execute(interaction: typeof Interaction) {
await interaction.reply("hello");
},
};
29 changes: 27 additions & 2 deletions src/bot/database/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@ import * as mongoose from "mongoose";
const guildConfigSchema = new mongoose.Schema(
{
guildId: {type: String, required: true},
tempVoiceChannelId: {type: String, required: true},
tempVoiceCategoryId: {type: String, required: true}
tempVoiceEnabled: {type: Boolean, required: true},
tempVoiceChannelId: {type: String},
tempVoiceCategoryId: {type: String},
tempTextEnabled: {type: Boolean, required: true},
tempTextChannelId: {type: String},
tempTextCategoryId: {type: String},
ticketsEnabled: {type: Boolean, required: true},
ticketsMessageId: {type: String},
ticketsCategoryId: {type: String},
}
)

Expand All @@ -17,6 +24,24 @@ const tempVoiceSchema = new mongoose.Schema(
}
)

const tempTextSchema = new mongoose.Schema(
{
tempTextId: {type: String},
guildId: {type: String, required: true},
textChannelId: {type: String, required: true},
ownerId: {type: String, required: true}
}
)

const ticketSchema = new mongoose.Schema(
{
ticketId: {type: String},
guildId: {type: String, required: true},
ticketChannelId: {type: String, required: true},
ownerId: {type: String, required: true}
}
)

tempVoiceSchema.pre('save', function(next) {
const randomString = Math.random().toString(36).substring(2, 8);
this.tempVoiceId = randomString;
Expand Down
23 changes: 16 additions & 7 deletions src/bot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ for (const folder of commandFolders) {
}
}

/*
// Load buttons
logger.info("Loading buttons");
client.buttons = new Map();
const buttonsPath = path.join(__dirname, "./components/buttons");
const buttonsPath = path.join(import.meta.dir, "./components/buttons");
const buttonFiles = fs
.readdirSync(buttonsPath)
.filter((file: string) => file.endsWith(".ts"));
Expand All @@ -54,13 +53,24 @@ for (const file of buttonFiles) {
const button = require(`${buttonsPath}/${file}`);
client.buttons.set(button.data.customId, button);
}
*/

/*
// Load select menus
logger.info("Loading select menus");
client.buttons = new Map();
const selectMenusPath = path.join(import.meta.dir, "./components/selectmenus");
const selectMenuFiles = fs
.readdirSync(buttonsPath)
.filter((file: string) => file.endsWith(".ts"));

for (const file of buttonFiles) {
const selectMenu = require(`${selectMenusPath}/${file}`);
client.selectMenus.set(selectMenu.data.customId, selectMenu);
}

// Load modals
logger.info("Loading modals");
client.modals = new Map();
const modalsPath = path.join(__dirname, "./components/modals");
const modalsPath = path.join(import.meta.dir, "./components/modals");
const modalFiles = fs
.readdirSync(modalsPath)
.filter((file: string) => file.endsWith(".ts"));
Expand All @@ -69,11 +79,10 @@ for (const file of modalFiles) {
const model = require(`${modalsPath}/${file}`);
client.modals.set(model.data.customId, model);
}
*/

// Handle events
logger.info("Loading events");
const eventsPath = path.join(__dirname, "events");
const eventsPath = path.join(import.meta.dir, "events");
const eventFiles = fs
.readdirSync(eventsPath)
.filter((file: string) => file.endsWith(".ts"));
Expand Down
12 changes: 12 additions & 0 deletions src/templates/button.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { ButtonBuilder, ButtonStyle, Interaction } = require("discord.js");
const config = require("../../config.ts");

module.exports = {
button: new ButtonBuilder()
.setLabel("label")
.setCustomId("id")
.setStyle(ButtonStyle),
async execute(interaction: typeof Interaction) {
// Logic
},
};
9 changes: 9 additions & 0 deletions src/templates/modal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { EmbedBuilder, Interaction } = require("discord.js");
const config = require("../../config.ts");

module.exports = {
modal: () => {},
async execute(interaction: typeof Interaction) {
// Logic
},
};

0 comments on commit 8f2f38e

Please sign in to comment.