-
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.
- Loading branch information
1 parent
1db8c98
commit f281ce9
Showing
4 changed files
with
54 additions
and
0 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,3 +1,9 @@ | ||
# dictionary-discord-bot | ||
|
||
The official dictionary Discord bot for Kumilinwa, the trans constructed language! :3 | ||
|
||
## How's it work? | ||
|
||
The bot is a simple Discord bot that uses the [Discord.js](https://discord.js.org) library to interact with the [Discord API](https://discord.dev). It uses slash commands to interact with the user. | ||
|
||
The language specification is cached in a JSON file and refreshed hourly to prevent a stale cache. The search looks through the specification and returns matches. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,37 @@ | ||
import { | ||
ChatInputCommandInteraction, | ||
EmbedBuilder, | ||
SlashCommandBuilder | ||
} from 'discord.js'; | ||
import { Duration } from 'luxon'; | ||
|
||
export const data = new SlashCommandBuilder() | ||
.setName('status') | ||
.setDescription('Get bot status') | ||
.addBooleanOption(option => | ||
option | ||
.setName('ephemeral') | ||
.setDescription('Set the response to ephemeral') | ||
.setRequired(false) | ||
); | ||
|
||
export async function execute(interaction: ChatInputCommandInteraction) { | ||
const ephemeral = interaction.options.getBoolean('ephemeral') ?? false; | ||
await interaction.reply({ | ||
ephemeral, | ||
embeds: [ | ||
new EmbedBuilder().setTitle('Bot Status').setFields( | ||
{ | ||
name: 'Uptime', | ||
value: Duration.fromMillis(interaction.client.uptime).toHuman({ | ||
listStyle: 'long' | ||
}) | ||
}, | ||
{ | ||
name: 'Latency (ms)', | ||
value: interaction.client.ws.ping.toString() | ||
} | ||
) | ||
] | ||
}); | ||
} |