This repository has been archived by the owner on Jul 25, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: prisma+mongo db, cooldowns, and more!
- Loading branch information
Showing
33 changed files
with
789 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
DISCORD_TOKEN="YOUR-TOKEN-HERE" | ||
DATABASE_URL="YOUR-MONGODB-CONNECTION-STRING-HERE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
|
||
datasource db { | ||
provider = "mongodb" | ||
url = env("DATABASE_URL") | ||
} | ||
|
||
model GuildConfig { | ||
id String @id @default(auto()) @map("_id") @db.ObjectId | ||
guildId String @unique | ||
language String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { ChatInputCommand, Command, RegisterBehavior } from "@sapphire/framework"; | ||
import { ApplyOptions } from "@sapphire/decorators"; | ||
import { BaseEmbedBuilder } from "../../libraries/structures/components"; | ||
import { parseEmojiByID } from "../../libraries/utils/common/parsers"; | ||
|
||
@ApplyOptions<Command.Options>({ | ||
name: "language", | ||
fullCategory: ["Configuration"] | ||
}) | ||
export class LanguageCommand extends Command { | ||
public override registerApplicationCommands(registry: ChatInputCommand.Registry) { | ||
registry.registerChatInputCommand( | ||
(builder) => | ||
builder | ||
.setName("language") | ||
.setDescription("Change the language of the bot for the server.") | ||
.addStringOption((option) => | ||
option | ||
.setName("lang") | ||
.setDescription("The language you want to set for the server.") | ||
.setRequired(false) | ||
.addChoices({ name: "English", value: "en-US" }) | ||
), | ||
{ behaviorWhenNotIdentical: RegisterBehavior.Overwrite } | ||
); | ||
} | ||
|
||
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) { | ||
const lang = interaction.options.getString("lang") as Language; | ||
const dbLang = await this.getCurrentLang(interaction.guildId as string); | ||
const infoEmoji = parseEmojiByID("1126390222620463214"); | ||
const embed = new BaseEmbedBuilder(); | ||
|
||
if (!lang) { | ||
embed.setDescription(`${infoEmoji} The current language for this server is: **\`${dbLang}\`**`); | ||
} else { | ||
embed.isErrorEmbed().setDescription("To be implemented."); | ||
} | ||
return interaction.reply({ embeds: [embed] }); | ||
} | ||
|
||
private async getCurrentLang(guildId: string) { | ||
const db = await this.container.database.guildConfig.findUnique({ | ||
where: { guildId: guildId } | ||
}); | ||
|
||
return db?.language; | ||
} | ||
} | ||
|
||
type Language = "en-US"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
3 changes: 2 additions & 1 deletion
3
src/languages/en-US/commands/help.json → src/languages/en-US/commands/core/help.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"HELP_HELPCMD_DESCRIPTION": "Display the help menu or help for a specific command.", | ||
"HELP_PINGCMD_DESCRIPTION": "Check if the bot is alive.", | ||
"HELP_CHATCMD_DESCRIPTION": "Chat to Akari." | ||
"HELP_CHATCMD_DESCRIPTION": "Chat to Akari.", | ||
"HELP_LANGCMD_DESCRIPTION": "Change the language of the bot for the server." | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"CHAT_FAILED": "An error occurred while fetching response from AI. Please try again.", | ||
"CHAT_TIMEOUT": "AI server is taking too long to respond. Please try again later.", | ||
"CHAT_SERVER_DOWN": "AI server is down. Please try again later." | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const HELP_HELPCMD_DESCRIPTION = "commands/core/help:HELP_HELPCMD_DESCRIPTION"; | ||
export const HELP_PINGCMD_DESCRIPTION = "commands/core/help:HELP_PINGCMD_DESCRIPTION"; | ||
export const HELP_CHATCMD_DESCRIPTION = "commands/core/help:HELP_CHATCMD_DESCRIPTION"; | ||
export const HELP_LANGCMD_DESCRIPTION = "commands/core/help:HELP_LANGCMD_DESCRIPTION"; |
Oops, something went wrong.