This repository is a Discord bot built using Rust's Serenity. Hosting is provided by Shuttle.
Since it is still under development, it has quite a few features, but the following functions are available
- When you make a mentions to the Bot, it gets the 5 latest messages and GPT will answer them.
- When a URL of x.com or twitter.com is pasted, it is converted to vxtwitter.com and posted
Install various required packages using Cargo. Build is also performed at the same time.
cargo build
To run this bot, you need a valid Discord token; login to the Discord Developer Portal.
The required authority is "MESSAGE CONTENT INTENT"
Note
The official Shuttle website describes how to install the Hello world bot, but it also describes the operation of the Discord Developers Portal, so please refer to that if you are not sure.
To run this bot, you need a valid OpenAI token; login to the OpenAI Profile | User APPI keys.
Warning
You must have charged credits to use OpenAI's ChatGPT API.
Please install it beforehand, as it will be installed using cargo-binstall.
Install the cargo-shuttle binary.
cargo install cargo-shuttle
Log in to Shuttle.
You will be asked to enter your API key, which can be obtained from the following location after logging into your browser dashboard: https://console.shuttle.rs/account/overview
cargo shuttle login
DISCORD_TOKEN="{{ token }}"
CHATGPT_TOKEN="{{ token }}"
Tip
Shuttle refers to the value in Secrets.toml, not the env file.
Initial project setup for Shuttle. Here you can specify the project name, etc.
cargo shuttle init
shuttle project new --idle-minutes 0
Tip
Since the application sleeps after 30 minutes of inactivity, the --idle-minutes
option can be used to set the application not to sleep when the project is created.
Use the --allow-dirty
option to upload Secrets.toml to Shuttle, which will not be pushed to Git the first time.
https://docs.shuttle.rs/getting-started/shuttle-commands
cargo shuttle deploy --allow-dirty
Check the online status of the bot you let join the Discord, and try mentions to see how it works!