https://github.com/clxrityy/ai-discord-bot
A template for an AI discord bot that is configurable through each guild
https://github.com/clxrityy/ai-discord-bot
ai aws bot discord pm2 typescript
Last synced: 5 months ago
JSON representation
A template for an AI discord bot that is configurable through each guild
- Host: GitHub
- URL: https://github.com/clxrityy/ai-discord-bot
- Owner: clxrityy
- License: mit
- Created: 2024-02-18T21:31:25.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-14T20:55:37.000Z (almost 2 years ago)
- Last Synced: 2024-09-15T05:32:23.543Z (almost 2 years ago)
- Topics: ai, aws, bot, discord, pm2, typescript
- Language: TypeScript
- Homepage: https://dev.to/clxrityy/how-to-create-a-dynamic-ai-discord-bot-with-typescript-3gjn
- Size: 169 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ai-discord-bot template
### 🔗 [Invite](https://discord.com/api/oauth2/authorize?client_id=1207469340149026837&permissions=2147483648&scope=bot)
### 📖 [Read the guide](https://dev.to/clxrityy/how-to-create-a-dynamic-ai-discord-bot-with-typescript-3gjn)
---
## configuration
#### [`config.ts`](/src/config.ts)
```ts
/*
Your default AI settings
*/
openai: {
model: /**
https://platform.openai.com/docs/models
*/ ,
systemRoleContent: /**
https://platform.openai.com/docs/guides/text-generation/chat-completions-api
*/,
temperature: /**
https://platform.openai.com/docs/guides/text-generation/how-should-i-set-the-temperature-parameter
*/,
presence_penalty: /**
https://platform.openai.com/docs/guides/text-generation/parameter-details
*/,
}
```
#### [`.env`](/.env.example)
```env
# DISCORD
BOT_TOKEN=
# OPENAI
OPENAI_API_KEY=
OPENAI_ORGANIZATION_ID=
# MONOGDB
MONGO_URI=
```
---
## commands
- `/ai` **`[prompt]`**
- `/settings`
- `config`
- [model](https://platform.openai.com/docs/models)
- [precense_penalty](https://platform.openai.com/docs/guides/text-generation/parameter-details)
- [role](https://platform.openai.com/docs/guides/text-generation/chat-completions-api)
- [temperature](https://platform.openai.com/docs/guides/text-generation/how-should-i-set-the-temperature-parameter)
- `view`
- `reset`
- `help`
---
## deployment
- create and connect to an [AWS instance](https://ca-central-1.console.aws.amazon.com/ec2/home?c=ec2&p=pm®ion=ca-central-1&z=1#Home:)
#### environment set up
```ubuntu
sudo apt update
```
- install node & npm
```ubuntu
sudo apt install nodejs
```
```
sudo apt install npm
```
- set to the latest node version
```
sudo n 21.6.2
```
- check for the latest node version
```ubuntu
node --version
```
- if you're stealing an earlier version, run
```ubuntu
hash -r
```
#### bot set up
- make a directory for the bot
```ubuntu
mkdir bot
```
```ubuntu
cd bot
```
- clone the repo into the bot folder
```ubuntu
git clone https://github.com/clxrityy/ai-discord-bot.git .
```
- input your environment variables
```ubuntu
cat > .env >> # your variables
```
#### deploy
- install `pm2`
```ubuntu
sudo npm i pm2 -g
```
- build and then deploy from `/dist`
```ubuntu
npm run build
```
```ubuntu
pm2 start ./dist/index.js --name bot-name
```