~phate/rsPhate

A discord bot written in Rust.
update LICENSE
add neko command, remove rofl dependency
add workaround for incorrectly named jpe files

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~phate/rsPhate
read/write
git@git.sr.ht:~phate/rsPhate

You can also use your local clone with git send-email.

#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.*
  • ^noice: Bot will reply with image from his just_yes folder, image will be spoiler'd
  • ^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.