Implemented new Commands:
help - list all commands timestamp - convert date to timestamp (still in progress) about - Bot porpose (still in progress) ping - check bot availability
This commit is contained in:
@@ -6,19 +6,15 @@ Im going to make a To-do List for the features i want to implement for my Bot.
|
|||||||
(I will try to make these tools optional, because alot of bots already feature them)
|
(I will try to make these tools optional, because alot of bots already feature them)
|
||||||
|
|
||||||
1. **Basic Commands**
|
1. **Basic Commands**
|
||||||
- [ ] Add a `!help` command to display a list of available commands.
|
- [x] Add a `!help` command to display a list of available commands.
|
||||||
- [ ] Implement a `!ping` command to check bot responsiveness.
|
- [x] Implement a `!ping` command to check bot responsiveness.
|
||||||
- [ ] Add a `!about` command to describe the bot's purpose.
|
- [ **in progress** ] Add a `!about` command to describe the bot's purpose.
|
||||||
|
|
||||||
2. **Welcome and Goodbye System**
|
2. **Role Management**
|
||||||
- [ ] Create a system to welcome new users to the server with a customizable message.
|
|
||||||
- [ ] Implement a goodbye message when users leave the server.
|
|
||||||
|
|
||||||
3. **Role Management**
|
|
||||||
- [ ] Set up a self-assignable role system (e.g., using reaction roles).
|
- [ ] Set up a self-assignable role system (e.g., using reaction roles).
|
||||||
- [ ] Allow admins to assign/remove roles with commands.
|
- [ ] Allow admins to assign/remove roles with commands.
|
||||||
|
|
||||||
4. **Moderation Tools**
|
3. **Moderation Tools**
|
||||||
- [ ] Add commands to mute, kick, and ban users.
|
- [ ] Add commands to mute, kick, and ban users.
|
||||||
- [ ] Create an auto-moderation feature to delete spam or inappropriate content.
|
- [ ] Create an auto-moderation feature to delete spam or inappropriate content.
|
||||||
- [ ] Implement a warning system with a strike counter.
|
- [ ] Implement a warning system with a strike counter.
|
||||||
@@ -35,9 +31,10 @@ Im going to make a To-do List for the features i want to implement for my Bot.
|
|||||||
- [ ] Allow users to purchase roles using the currency with a command (e.g., `!buyrole [role name]`).
|
- [ ] Allow users to purchase roles using the currency with a command (e.g., `!buyrole [role name]`).
|
||||||
|
|
||||||
2. **Datetime Converter**
|
2. **Datetime Converter**
|
||||||
- [ ] Create a command to convert timezones:
|
(Still in Progress, maybe i'll add visual Menu)
|
||||||
- [ ] `!convert [time] [timezone] to [timezone]` to handle conversions.
|
- [x] Create a command to convert timezones:
|
||||||
- [ ] Support both 12-hour and 24-hour formats.
|
- [x] `!convert [time] [timezone] to [timezone]` to handle conversions.
|
||||||
|
- [x] Support both 12-hour and 24-hour formats.
|
||||||
- [ ] Include a command to display server-specific or user-specific timezones.
|
- [ ] Include a command to display server-specific or user-specific timezones.
|
||||||
|
|
||||||
3. **Minigames**
|
3. **Minigames**
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
const { SlashCommandBuilder } = require('discord.js');
|
||||||
|
const moment = require('moment'); // Install moment.js with `npm install moment`
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
data: new SlashCommandBuilder()
|
||||||
|
.setName('timestamp')
|
||||||
|
.setDescription('Convert a human-readable date to a Discord timestamp.')
|
||||||
|
.addStringOption(option =>
|
||||||
|
option
|
||||||
|
.setName('date')
|
||||||
|
.setDescription('The date to convert (e.g., YYYY-MM-DD HH:mm)')
|
||||||
|
.setRequired(true)
|
||||||
|
)
|
||||||
|
.addStringOption(option =>
|
||||||
|
option
|
||||||
|
.setName('format')
|
||||||
|
.setDescription('The format for the timestamp')
|
||||||
|
.setRequired(false)
|
||||||
|
.addChoices(
|
||||||
|
{ name: 'Short time', value: 't' },
|
||||||
|
{ name: 'Long time', value: 'T' },
|
||||||
|
{ name: 'Short date', value: 'd' },
|
||||||
|
{ name: 'Long date', value: 'D' },
|
||||||
|
{ name: 'Full date and time', value: 'f' },
|
||||||
|
{ name: 'Full date and time with weekday', value: 'F' },
|
||||||
|
{ name: 'Relative time', value: 'R' },
|
||||||
|
)),
|
||||||
|
async execute(interaction) {
|
||||||
|
// Get user input
|
||||||
|
const dateInput = interaction.options.getString('date');
|
||||||
|
const format = interaction.options.getString('format') || 'f'; // Default to 'f' format
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Convert the date to a Unix timestamp
|
||||||
|
const unixTimestamp = moment(dateInput, 'YYYY-MM-DD HH:mm').unix();
|
||||||
|
|
||||||
|
if (isNaN(unixTimestamp)) {
|
||||||
|
return interaction.reply({
|
||||||
|
content: 'Invalid date. Use the format `YYYY-MM-DD HH:mm`.',
|
||||||
|
ephemeral: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct the Discord timestamp
|
||||||
|
const discordTimestamp = `<t:${unixTimestamp}:${format}>`;
|
||||||
|
|
||||||
|
// Reply with the result
|
||||||
|
await interaction.reply(
|
||||||
|
`Here’s your Discord timestamp:\n${discordTimestamp}`
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
await interaction.reply({
|
||||||
|
content:
|
||||||
|
'Invalid date format. Please use the format `YYYY-MM-DD HH:mm` (e.g., `2025-01-25 14:30`).',
|
||||||
|
ephemeral: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
const {SlashCommandBuilder} = require("discord.js");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
data: new SlashCommandBuilder()
|
||||||
|
.setName("about")
|
||||||
|
.setDescription("Information about this bot"),
|
||||||
|
async execute(interaction) {
|
||||||
|
await interaction.reply({
|
||||||
|
content: "This bot has some general commands for moderation, but includes on or two unqiue features, like the currenc system. It's a small project to enhanced the programming skills of the creator.",
|
||||||
|
ephemeral: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
const { SlashCommandBuilder} = require("discord.js");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
data: new SlashCommandBuilder()
|
||||||
|
.setName('help')
|
||||||
|
.setDescription('Gives all available commands.'),
|
||||||
|
async execute(interaction) {
|
||||||
|
// Map over the full command objects to get names and descriptions
|
||||||
|
const commandDetails = interaction.client.commands.map(cmd => ({
|
||||||
|
name: cmd.data.name,
|
||||||
|
description: cmd.data.description,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Format the commands into a user-friendly help message
|
||||||
|
const helpMessage = commandDetails
|
||||||
|
.map(detail => `/${detail.name} - ${detail.description}`)
|
||||||
|
.join('\n');
|
||||||
|
|
||||||
|
// Send the help message
|
||||||
|
await interaction.reply(`Here are all the available commands:\n\n${helpMessage}`);
|
||||||
|
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -3,8 +3,8 @@ const { SlashCommandBuilder } = require('discord.js');
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName('ping')
|
.setName('ping')
|
||||||
.setDescription('Replies with Pong!'),
|
.setDescription('Check if the bots responsivnes'),
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.reply('Pong!');
|
await interaction.reply({ content: 'Pong! (Online)', ephemeral: true });
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
Generated
+10
@@ -13,6 +13,7 @@
|
|||||||
"better-sqlite3": "^11.3.0",
|
"better-sqlite3": "^11.3.0",
|
||||||
"discord.js": "^14.17.3",
|
"discord.js": "^14.17.3",
|
||||||
"express": "^4.21.0",
|
"express": "^4.21.0",
|
||||||
|
"moment": "^2.30.1",
|
||||||
"openai": "^4.67.3",
|
"openai": "^4.67.3",
|
||||||
"sqlite3": "^5.1.7"
|
"sqlite3": "^5.1.7"
|
||||||
}
|
}
|
||||||
@@ -1738,6 +1739,15 @@
|
|||||||
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
|
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/moment": {
|
||||||
|
"version": "2.30.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
|
||||||
|
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/ms": {
|
"node_modules/ms": {
|
||||||
"version": "2.1.3",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
"better-sqlite3": "^11.3.0",
|
"better-sqlite3": "^11.3.0",
|
||||||
"discord.js": "^14.17.3",
|
"discord.js": "^14.17.3",
|
||||||
"express": "^4.21.0",
|
"express": "^4.21.0",
|
||||||
|
"moment": "^2.30.1",
|
||||||
"openai": "^4.67.3",
|
"openai": "^4.67.3",
|
||||||
"sqlite3": "^5.1.7"
|
"sqlite3": "^5.1.7"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user