diff --git a/package.json b/package.json index ae2f22e..b7ee136 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chaise_bot_3.0", - "version": "3.0.0", + "version": "3.1.0", "description": "", "main": "index.js", "type": "module", diff --git a/src/commands/default/botinfo.ts b/src/commands/default/botinfo.ts new file mode 100644 index 0000000..485de19 --- /dev/null +++ b/src/commands/default/botinfo.ts @@ -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 ] }); + }, +}; diff --git a/src/commands/default/help.ts b/src/commands/default/help.ts index de8058c..460897e 100644 --- a/src/commands/default/help.ts +++ b/src/commands/default/help.ts @@ -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()) ] }); }, }; diff --git a/src/commands/default/quota.ts b/src/commands/default/quota.ts index 9806748..735b2ee 100644 --- a/src/commands/default/quota.ts +++ b/src/commands/default/quota.ts @@ -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()) ] }); }, }; diff --git a/src/commands/default/vote.ts b/src/commands/default/vote.ts new file mode 100644 index 0000000..bcfc10d --- /dev/null +++ b/src/commands/default/vote.ts @@ -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 ] }); + }, +}; diff --git a/src/events/ready.ts b/src/events/ready.ts index b948477..6737a7b 100644 --- a/src/events/ready.ts +++ b/src/events/ready.ts @@ -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(); diff --git a/src/libs/discord.ts b/src/libs/discord.ts index 7018f59..6e568fa 100644 --- a/src/libs/discord.ts +++ b/src/libs/discord.ts @@ -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.`)