This project has moved here. It should still work for the time being, but im no longer going to actively maintain this repo.
I got bored over the summer, so I decided to learn typescript by making a discord bot.
So far, the bot has limited functionality. However, I plan to add more features in the future when I have time. Currently, the bot can:
- get a users avatar
- get the latency of the bot
- get the uptime of the bot
So far, I have nothing planned, but I will add more features as I think of them. If you have any ideas, feel free to open an issue or make a pull request.
I am not currently hosting the bot, but if I do, I will add a link to invite the bot to your server. If you want to host it yourself, follow the steps below. To run it, you will need to have Docker installed on a linux machine. So far, I have tested it on Debian and Arch, it should work on wsl and other distros, but YMMV.
Run the install script:
curl -fsSL https://raw.githubusercontent.com/ash-entwisle/openbot/main/install/install.sh | sh
then edit the .env
nano .env
Then edit the config.toml
file:
nano config.toml
and start the docker containers:
docker compose up -d
If you want to contribute, feel free to fork the repo and make a pull request. If you have any questions, feel free to open an issue.
To add a command, create a file in a folder in src/commands/
with the name of the command.
For example, if you wanted to add a command called ping
, you would create a file called ping.ts
in src/commands/misc
.
Then, add the following code to the file:
import { latency } from '../../libs/sysinfo';
import { embed } from '../../libs/reply';
import { Command } from '../../libs/command';
export const data = new Command({
name: 'ping',
description: 'Get the latency of the bot.',
dmPermission: true,
nsfw: false,
admin: false,
execute: execute
})
export async function execute(interaction: any) {
embed({
interaction: interaction,
title: "",
content: `**Latency:** \`${latency(interaction)}ms.\``,
ephemeral: true
});
}
First, import all the libraries you need.
Then, create and export a Command
object with the properties found in the interface ICommandData
(found in ./src/libs/command.ts).
Then, export an execute
function that takes an interaction
object as an argument, this will be used to collect and format data, and send a reply.
Distriuted under the AGPL-3.0 License. See LICENSE
for more information.