···11-# FBT Security - Rust
22-33-This is the source code for the FBTHeaven discord bot.
44-55-I am the developer for version 2.0, it has been a stale unmaintained project for months but I didn't want my source to just wither untouched so I removed the API keys and added a hand full of `// TODO:`s to the code for you to find what discord IDs you need to change and what other keys you need to provide.
66-77-You will need a [Redis DB](https://redis.io/) for a bunch of features, no guide on setting one up atm (or possibly every, we'll see how I feel later)
88-You can also update a [Meilisearch DB](https://www.meilisearch.com/) with the same data, that one command is easy to comment out if you don't want to use that too
99-1010-I might clean this up further or add a branch for the old python version in the future.
1111-1212-good luck whoever may look upon my first large Rust project11+# FBT Security - Rust
22+33+This is the source code for the FBTHeaven discord bot.
44+55+## about
66+77+I am the developer for version 2.0, it has been a stale unmaintained project for months but I didn't want my source to just wither untouched so I removed the API keys and added a hand full of `// TODO:`s to the code for you to find what discord IDs you need to change and what other keys you need to provide.
88+99+You will need a [Redis DB](https://redis.io/) for a bunch of features, no guide on setting one up atm (or possibly every, we'll see how I feel later)
1010+You can also update a [Meilisearch DB](https://www.meilisearch.com/) with the same data, that one command is easy to comment out if you don't want to use that too
1111+1212+## redis layout
1313+1414+The db is split into 8 "folders".
1515+Redis is a key:value DB meaning you have just the name of the DB entry and then it's value, an example of this is the entry `user:0000000000000000000` which is an entry in the user "folder".
1616+1717+here are the "folders" and their descriptions:
1818+1919+- `authed-server-users:<DiscordServerID>`
2020+ - This is a Redis [SET](https://redis.io/docs/latest/develop/data-types/sets/) of discord user IDs who are authenticated in the server in the DB entry
2121+- `cleared-suer:<DiscordUserID>`
2222+ - this is a [JSON](https://redis.io/docs/latest/develop/data-types/json/) entry of users who are cleared as okay in the DB after being flagged
2323+ - Json format:
2424+2525+ ```JSON
2626+ {
2727+ "user_id": "0000000000000000000",
2828+ "username": "TestUsername#0001",
2929+ "where_found": "Name of guild",
3030+ "reason": "Admin enters custom reason here"
3131+ }
3232+ ```
3333+3434+- `feedback:<timestamp>-<DiscordUserID>-<DiscordUserName>`
3535+ - This is just a [String](https://redis.io/docs/latest/develop/data-types/strings/) containing whatever feedback they put in the feedback command
3636+- `guild-settings:<DiscordGuildID>`
3737+ - This is a [JSON](https://redis.io/docs/latest/develop/data-types/json/) entry containing if the server has auto kick enabled or not as well as the channel id for bot announcements
3838+3939+ ```json
4040+ {
4141+ "channel_id": "0000000000000000000",
4242+ "kick": true,
4343+ "server_name": "Name of the guild"
4444+ }
4545+ ```
4646+4747+- `monitroted-guild:<DiscordGuildID>`
4848+ - This is a [JSON](https://redis.io/docs/latest/develop/data-types/json/) entry containing info about tracked servers. this is only inside of the `_deprecated.rs` as it was a hold over from the old Python verion's SQLite DB. more info about this one will come with the Python source code later™️
4949+5050+ ```json
5151+ {
5252+ "guild_name": "Example guild name",
5353+ "guild_id": "0000000000000000000",
5454+ "invite_link": "https://discord.gg/example",
5555+ "updated": "Never",
5656+ "status": "Unknown"
5757+ }
5858+ ```
5959+6060+- `status:commands-executed`
6161+ - this is a simple [String](https://redis.io/docs/latest/develop/data-types/strings/) entry to track how many commands have run since the feature was implemented, it appears at the bottom of the `/about` command
6262+- `user:<DiscordUserID>`
6363+ - This is the largest list of entries in the DB.
6464+ - These are [JSON](https://redis.io/docs/latest/develop/data-types/json/) entries for users who are uploaded via scrapped discords, more info on that in the next section
6565+6666+ ```json
6767+ {
6868+ "vrc_id": "ID/Profile URL enetered on a per user basis",
6969+ "username": "DiscordUsername",
7070+ "discord_id": "0000000000000000000",
7171+ "offences": [
7272+ {
7373+ "guild_id": "0000000000000000000",
7474+ "reason": "Reason for adding to list. typically name of discord server found, date and a key from the /key command",
7575+ "image": "URL(s) to image(s) if user was added manually for evidence",
7676+ "extra": "Other text here, mainly for links to extra files"
7777+ }
7878+ ]
7979+ }
8080+ ```
8181+8282+- `kick-whitelist`
8383+ - This is a [SET](https://redis.io/docs/latest/develop/data-types/sets/) that I didn't put in a folder for some reason. It holds a list of DiscordUserIDs that should be ignored when running the `/excel` command.
8484+8585+# scrape discords
8686+8787+So the main use of this bot origionally was as follows:
8888+8989+- scrape discord using [DiscordChatExporter](https://github.com/Tyrrrz/DiscordChatExporter)
9090+- run resulting .csv files though [my old parser](https://github.com/BuyMyMojo/discord-chat-parser)
9191+- resulting file to the bot using the `/excel` command
9292+9393+This was to be used to scrape servers of bad actors such as VRC model rippers and leakers, it would add every user found inside the server into the DB with a description of the server that they are found in.
9494+9595+Once in the DB whenever the user joined a server with the FBT bot active the server owner/mods would get notified of a bad actor joining or optionally it would auto kick these accounts.
9696+9797+# that's all folks
9898+9999+I might clean this up further or add a branch for the old python version in the future.
100100+101101+good luck whoever may look upon my first large Rust project
102102+103103+<p style="color: rgba(0, 0, 0, 0)">
104104+There is no database files or user entries here, look somewhere else <3
105105+</p>