added /vote and /botinfo commands
This commit is contained in:
parent
1d7bfa1407
commit
2abd90c671
7 changed files with 52 additions and 10 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "chaise_bot_3.0",
|
||||
"version": "3.0.0",
|
||||
"version": "3.1.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
|
|
22
src/commands/default/botinfo.ts
Normal file
22
src/commands/default/botinfo.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
import { SlashCommandBuilder, CommandInteraction, EmbedBuilder } from "discord.js";
|
||||
|
||||
export default {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("botinfo")
|
||||
.setDescription("Get the infos about the bot")
|
||||
.setDMPermission(true),
|
||||
async execute(interaction: CommandInteraction) {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle("Bot infos")
|
||||
.setDescription(
|
||||
`
|
||||
- Servers : ${interaction.client.guilds.cache.size}
|
||||
- Users : ${interaction.client.users.cache.size}
|
||||
`
|
||||
)
|
||||
.setFooter({ text: "Bot by @ninja_jambon.", iconURL: interaction.client.user.displayAvatarURL()})
|
||||
.setColor("#000000");
|
||||
|
||||
interaction.reply({ embeds: [ embed ] });
|
||||
},
|
||||
};
|
|
@ -6,6 +6,6 @@ export default {
|
|||
.setName("help")
|
||||
.setDescription("Send the help message"),
|
||||
async execute(interaction: CommandInteraction) {
|
||||
await interaction.reply({ embeds: [ helpEmbed() ] });
|
||||
await interaction.reply({ embeds: [ helpEmbed(interaction.client.user.displayAvatarURL()) ] });
|
||||
},
|
||||
};
|
||||
|
|
|
@ -17,9 +17,9 @@ export default {
|
|||
connection.end();
|
||||
|
||||
if (!user[0]) {
|
||||
return interaction.editReply({ embeds: [ errorEmbed("Try asking something to the bot before requesting your quota.") ] });
|
||||
return interaction.editReply({ embeds: [ errorEmbed("Try asking something to the bot before requesting your quota.", interaction.client.user.displayAvatarURL()) ] });
|
||||
}
|
||||
|
||||
interaction.editReply({ embeds: [ quotaEmbed(user[0].quota) ] });
|
||||
interaction.editReply({ embeds: [ quotaEmbed(user[0].quota, interaction.client.user.displayAvatarURL()) ] });
|
||||
},
|
||||
};
|
||||
|
|
18
src/commands/default/vote.ts
Normal file
18
src/commands/default/vote.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { SlashCommandBuilder, CommandInteraction, EmbedBuilder } from "discord.js";
|
||||
|
||||
export default {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("vote")
|
||||
.setDescription("Send the top.gg voting link")
|
||||
.setDMPermission(true),
|
||||
async execute(interaction: CommandInteraction) {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle("Voting link")
|
||||
.setURL("https://top.gg/bot/1059559067846189067/vote")
|
||||
.setDescription("You can vote for Odin using this [link](https://top.gg/bot/1059559067846189067/vote).\nThank you !")
|
||||
.setFooter({ text: "Bot by @ninja_jambon.", iconURL: interaction.client.user.displayAvatarURL()})
|
||||
.setColor("#000000");
|
||||
|
||||
interaction.reply({ embeds: [ embed ] });
|
||||
},
|
||||
};
|
|
@ -7,7 +7,7 @@ export default {
|
|||
execute(client: Client) {
|
||||
console.log(`Ready! Logged in as ${client.user?.tag}`);
|
||||
|
||||
client.user?.setPresence({ activities: [{ name: '/ask | Version 3.0 !', type: 3 }] });
|
||||
client.user?.setPresence({ activities: [{ name: '/help | Version 3.0 !', type: 3 }] });
|
||||
|
||||
setInterval(async () => {
|
||||
await checkReset();
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Events, Message, Collection, EmbedBuilder, WebhookClient } from "discor
|
|||
import { getChatResponse, MistralMessage, Models, InputPrice, OutputPrice, ReturnedValue, Prompts } from "../libs/mistralai.js";
|
||||
import { User, connectToDb, addUser, getUser, incrementQuota } from "../libs/mysql.js";
|
||||
|
||||
export function helpEmbed() {
|
||||
export function helpEmbed(iconURL: string) {
|
||||
return new EmbedBuilder()
|
||||
.setTitle("Help :")
|
||||
.setDescription(
|
||||
|
@ -12,6 +12,8 @@ export function helpEmbed() {
|
|||
- \`/help\` : display this message
|
||||
- \`/ask\` : make a single request to mistralAi API
|
||||
- \`/quota\` : send how many credits you have left for the month
|
||||
- \`/botinfo\` : send the infos about the bot
|
||||
- \`/vote\` : send the top.gg vote link of the bot
|
||||
|
||||
**Other way to use the bot**
|
||||
|
||||
|
@ -20,15 +22,15 @@ export function helpEmbed() {
|
|||
|
||||
**Quota**
|
||||
|
||||
- You have 0.4$ of free credits
|
||||
- You have 0.4$ of free credits each month
|
||||
`
|
||||
)
|
||||
.setFooter({ text: "Bot by @ninja_jambon."})
|
||||
.setFooter({ text: "Bot by @ninja_jambon.", iconURL: iconURL})
|
||||
.setColor("#000000");
|
||||
|
||||
}
|
||||
|
||||
export function errorEmbed(error: string) {
|
||||
export function errorEmbed(error: string, iconURL: string) {
|
||||
return new EmbedBuilder()
|
||||
.setTitle("Error")
|
||||
.setDescription(error)
|
||||
|
@ -36,7 +38,7 @@ export function errorEmbed(error: string) {
|
|||
.setColor("#000000");
|
||||
}
|
||||
|
||||
export function quotaEmbed(quota: number) {
|
||||
export function quotaEmbed(quota: number, iconURL: string) {
|
||||
return new EmbedBuilder()
|
||||
.setTitle("Quota left")
|
||||
.setDescription(`You have ${0.4 - quota}$ left this month.`)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue