A discord bot written in Rust.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Ash 5ead9ac375
sync repo with sourcehut repo
10 months ago
images update bot photo 12 months ago
scripts sync repo with sourcehut repo 10 months ago
src sync repo with sourcehut repo 10 months ago
.env replace println instances with appropriate info or error 12 months ago
.gitignore initial commit 12 months ago
Cargo.lock sync repo with sourcehut repo 10 months ago
Cargo.toml use mpd crate to obtain music info instead of a subshell and mpc 11 months ago
LICENSE public domain, add some stuff 11 months ago
README.md public domain, add some stuff 11 months ago

README.md

rsPhate

license made-with-emacs lines of code

bot

A Discord bot written in Rust.

Anything with a "*" denotes an entry in the notes section.

How to use:

  • export DISCORD_TOKEN=token (obtain your token from the bot section of the developers part of discord's website).
  • cargo run or cargo run --release from the root dir of the repo, or at least, the .env and scripts/ must be in the CWD.
  • Args are delimited with , so make sure commands are ran like this: ^command arg,arg.

Current Commands

  • ^about: Bot will reply with pretty embed containing title and description of bot, as well as where to find the author (me).
  • ^date: Bot will reply with current date and time in this format -- 06:30 AM | Thu 21, May of 2020.
  • ^embed title,desc,<image_link>: Bot will generate an embed based on input and send it.*
  • ^help: Without args, bot will give a generalized help. Specifying a command or function will explain it.
  • ^fortune: Bot will reply with random fortune from fortune-mod-mythical-linux (repo is pinned to my profile if anyone is interested).*
  • ^git site,owner/repo: Bot will reply with full link to repo.
  • ^hmm: How much music does Phate have?
  • ^iv SEARCH: Bot will reply with an invidio link of the search query.*
  • ^math operation,num,num: Bot will do math for you (basic add/sub/div/mul) and reply with the result.*
  • ^meme position,text: Bot will generate a meme based on the input and send it as an image.
  • ^owo input: Bot will reply with OwO-ified input.
  • ^projects: Bot willk reply with pretty embed containing links to other projects by the author.
  • ^rng min,max: Bot will generate a random number between min and max and reply with the result.
  • ^rr: Bot will reply with a link (without a link preview) to Rick Astley's "Never Gonna Give You Up".
  • ^wipltrn: Bot will reply with pretty embed containing music info and cover art of Phate's currently playing music.*
  • ^ww {apple,steam,systemd}: Bot will reply with pretty embed explaining why the topic is bad.

Automated functions

  • If a message contains "youtube.com", react with disappointed face and send pretty embed full of info on invidio.us.
  • If a message contains "twitter.com", do the same as with messages containing "youtube.com" except the embed pertains to nitter.net.

Bot structure

  • .env: For environmental variables.
  • scripts/: Contains scripts to be ran for certain commands.
  • src/main.rs: The main file for the bot, it's responsible for everything except for defining the commands.
  • src/commands/* (except mod.rs): Define the commands to be used.
  • src/commands/mod.rs: For making the command files in src/commands/ public for use in src/main.rs.

Notes

  • embed: Image link is optional, it will be replaced with a 1px transparent image if not supplied, so it'll be like it's not even there. Also, don't forget to place your image link in brackets (<>) to disable the preview of them beforehand.
  • fortune: Potentially NSFW and offensive fortunes are enabled, use at your own risk.
  • math: Operation refers to multiply/divide/add/subtract. Example: ^math add,1,1 will make the bot reply with 2.
  • iv: Requires youtube-dl. Example: ^iv type o negative dead again will cause the bot to reply with an invidio link to the full album.
  • wipltrn: Requires mpc, and for the cover art to be present at /tmp/cover.png.