mirror of
https://github.com/aydenjahola/discord-multipurpose-bot.git
synced 2024-11-22 00:35:56 +00:00
Compare commits
No commits in common. "2895dc0f851b35c8b9cb65ef1360e79ab2784483" and "5a79b539b24bba5a1062787fe372257cff6dff00" have entirely different histories.
2895dc0f85
...
5a79b539b2
5 changed files with 13 additions and 52 deletions
|
@ -59,7 +59,3 @@ make sure to run `/setup` or otherwise the verification process wont work.
|
|||
## Usage
|
||||
|
||||
run `/help` command to get list of all avaiable commands, or visit the [commands](./commands/) directory to view them.
|
||||
|
||||
## Dashboard (WIP)
|
||||
|
||||
I am currently working on a dashboard to manage the bot as well, currently this is in the `dashboard` branch and still work in progress. if you know how to build discord bot dashboards then please feel free to contribute.
|
||||
|
|
|
@ -29,11 +29,11 @@ module.exports = {
|
|||
});
|
||||
}
|
||||
|
||||
const actionItemsChannelId = serverSettings.actionItemsChannelId;
|
||||
const actionItemChannelId = serverSettings.actionItemsChannelId;
|
||||
|
||||
if (interaction.channelId !== actionItemsChannelId) {
|
||||
if (interaction.channelId !== actionItemChannelId) {
|
||||
return interaction.reply({
|
||||
content: `This command can only be used in the <#${actionItemsChannelId}> channel.`,
|
||||
content: `This command can only be used in the <#${actionItemChannelId}> channel.`,
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ module.exports = {
|
|||
userTaskMap.get(user).push(task);
|
||||
}
|
||||
|
||||
// initial message content
|
||||
// Generate initial task list message
|
||||
let messageContent = `📝 **Action Items:**\n\n`;
|
||||
userTaskMap.forEach((tasks, user) => {
|
||||
messageContent += `👤 **Assigned to:** ${user}\n`;
|
||||
|
@ -85,7 +85,8 @@ module.exports = {
|
|||
messageContent += "\n";
|
||||
});
|
||||
|
||||
const targetChannelId = serverSettings.actionItemsTargetChannelId;
|
||||
// Fetch the specific channel to send the action items message
|
||||
const targetChannelId = "1164670538006933505";
|
||||
const targetChannel = await interaction.guild.channels.fetch(
|
||||
targetChannelId
|
||||
);
|
||||
|
@ -96,12 +97,14 @@ module.exports = {
|
|||
});
|
||||
}
|
||||
|
||||
// Send the action items message to the specified channel
|
||||
const actionMessage = await targetChannel.send({
|
||||
content: messageContent + `✅ React with a checkmark to complete tasks!`,
|
||||
});
|
||||
|
||||
await actionMessage.react("✅");
|
||||
|
||||
// Create reaction collector
|
||||
const filter = (reaction, user) => {
|
||||
return reaction.emoji.name === "✅" && userTaskMap.has(user);
|
||||
};
|
||||
|
@ -119,6 +122,7 @@ module.exports = {
|
|||
const nextTaskIndex = completedTasks.size;
|
||||
completedTasks.add(nextTaskIndex);
|
||||
|
||||
// Update message content
|
||||
let updatedMessageContent = `📝 **Action Items:**\n\n`;
|
||||
userTaskMap.forEach((userTasks, assignedUser) => {
|
||||
updatedMessageContent += `👤 **Assigned to:** ${assignedUser}\n`;
|
||||
|
@ -128,12 +132,14 @@ module.exports = {
|
|||
updatedMessageContent += "\n";
|
||||
});
|
||||
|
||||
// Edit the message to reflect the completion
|
||||
await actionMessage.edit({
|
||||
content:
|
||||
updatedMessageContent +
|
||||
`✅ React with a checkmark to complete tasks!`,
|
||||
});
|
||||
|
||||
// Notify the user about the completion
|
||||
await interaction.followUp({
|
||||
content: `${user} has completed task **${tasks[nextTaskIndex]}**!`,
|
||||
ephemeral: true,
|
||||
|
|
|
@ -64,14 +64,6 @@ module.exports = {
|
|||
? serverSettings.emailDomains.join(", ")
|
||||
: "None";
|
||||
|
||||
const actionItemsChannel = interaction.guild.channels.cache.get(
|
||||
serverSettings.actionItemsChannelId
|
||||
);
|
||||
|
||||
const actionItemsTargetChannel = interaction.guild.channels.cache.get(
|
||||
serverSettings.actionItemsTargetChannelId
|
||||
);
|
||||
|
||||
const settingsEmbed = new EmbedBuilder()
|
||||
.setColor("#0099ff")
|
||||
.setTitle("🌟 Current Server Settings 🌟")
|
||||
|
@ -93,19 +85,7 @@ module.exports = {
|
|||
value: serverSettings.verifiedRoleName || "None",
|
||||
inline: true,
|
||||
},
|
||||
{ name: "📧 Email Domains", value: emailDomains, inline: true },
|
||||
{
|
||||
name: "📋 Action Items Channel",
|
||||
value: actionItemsChannel ? `<#${actionItemsChannel.id}>` : "None",
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: "🎯 Action Items Target Channel",
|
||||
value: actionItemsTargetChannel
|
||||
? `<#${actionItemsTargetChannel.id}>`
|
||||
: "None",
|
||||
inline: true,
|
||||
}
|
||||
{ name: "📧 Email Domains", value: emailDomains, inline: true }
|
||||
)
|
||||
.setTimestamp()
|
||||
.setFooter({
|
||||
|
|
|
@ -42,14 +42,6 @@ module.exports = {
|
|||
"Select the allowed channel for action items. (Optional)"
|
||||
)
|
||||
.setRequired(false)
|
||||
)
|
||||
.addChannelOption((option) =>
|
||||
option
|
||||
.setName("actionitemstargetchannel")
|
||||
.setDescription(
|
||||
"Select the target channel where action items are going to be sent. (Optional)"
|
||||
)
|
||||
.setRequired(false)
|
||||
),
|
||||
|
||||
async execute(interaction) {
|
||||
|
@ -75,9 +67,6 @@ module.exports = {
|
|||
.map((domain) => domain.trim());
|
||||
const actionitemschannel =
|
||||
interaction.options.getChannel("actionitemschannel");
|
||||
const actionitemstargetchannel = interaction.options.getChannel(
|
||||
"actionitemstargetchannel"
|
||||
);
|
||||
|
||||
try {
|
||||
// Store the channel IDs instead of names
|
||||
|
@ -93,9 +82,6 @@ module.exports = {
|
|||
actionItemsChannelId: actionitemschannel
|
||||
? actionitemschannel.id
|
||||
: null,
|
||||
actionItemsTargetChannelId: actionitemstargetchannel
|
||||
? actionitemstargetchannel.id
|
||||
: null,
|
||||
},
|
||||
{ upsert: true, new: true }
|
||||
);
|
||||
|
@ -109,13 +95,7 @@ module.exports = {
|
|||
**Allowed Email Domains**: ${emailDomains.join(", ")}\n
|
||||
**Action Item Channel**: ${
|
||||
actionitemschannel ? `<#${actionitemschannel.id}>` : "None"
|
||||
}\n
|
||||
**Action Item Target Channel**: ${
|
||||
actionitemstargetchannel
|
||||
? `<#${actionitemstargetchannel.id}>`
|
||||
: "None"
|
||||
}
|
||||
`,
|
||||
}`,
|
||||
ephemeral: true,
|
||||
});
|
||||
} catch (error) {
|
||||
|
|
|
@ -8,7 +8,6 @@ const ServerSettingsSchema = new mongoose.Schema({
|
|||
generalChannelId: { type: String, required: false },
|
||||
emailDomains: { type: [String], required: false },
|
||||
actionItemsChannelId: { type: String, required: false },
|
||||
actionItemsTargetChannelId: { type: String, required: false },
|
||||
});
|
||||
|
||||
const ServerSettings = mongoose.model("ServerSettings", ServerSettingsSchema);
|
||||
|
|
Loading…
Reference in a new issue