Skip to content

Commit

Permalink
Better redis structure in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
NotNorom committed Feb 12, 2022
1 parent 95374a7 commit e8de485
Showing 1 changed file with 35 additions and 12 deletions.
47 changes: 35 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,39 @@

## Redis format

The key `BOT_PREFIX::GUILD_ID::CHANNEL_ID::CONF` points to a hashmap of possible configuration parameters.
The following strings are variables to be replaced in the redis keys:

- `BOT_PREFIX`: A prefix for the bot as to not confuse entries with other applications using the redis instance
- `GUILD_ID`: An ID of a discord guild. As time of writing, this is a 64 bit unsigned int
- `CHANNEL_ID`: An ID of a discord channel. As time of writing, this is a 64 bit unsigned int
- `MESSAGE_ID`: An ID of a discord message. As time of writing, this is a 64 bit unsigned int

### `BOT_PREFIX::CONF::GUILD_ID::CHANNEL_ID`
Points to a hashmap of possible configuration parameters.
Current config parameters are:
- tags (string):
the search query with each tag separated by spaces
- timeout (int):
if random_timeout is `false`, amount of minutes to wait till the next post.
if random_timeout is `true`, the maximum amount of minutes a timeout is choosen from.
- random_timeout (bool):
if a random timeout should be used
- nsfw (string):
decides if queries are done against e621 or e926.
if "sfw" e926.net is used.
if "nsfw" e621.net is used.
- tags (`string`):
- the search query with each tag separated by spaces
- timeout (`int`):
- if random_timeout is `false`, amount of minutes to wait till the next post
- if random_timeout is `true`, the maximum amount of minutes a timeout is choosen from
- random_timeout (`bool`):
- if a random timeout should be used
- nsfw (`string`):
- decides if queries are done against e621.net or e926.net
- if `sfw`, then e926.net is used
- if `nsfw`, then e621.net is used
- repost_cache_timeout (`int`):
- amount of minutes that an entry is kept in cache

### `BOT_PREFIX::POSTS::GUILD_ID::CHANNEL_ID::MESSAGE_ID`
A hashmap:
- post_id (`int`):
- the e621/e926 post id
- downvotes (`int`):
- number of times a user has clicked the downvote button (on discord, not the actual post)
- upvotes (`int`):
- inverse to downvotes
- delete_threshold (`int`):
- downvotes needed for the post to be deleted
A sorted hashmap with the key being a post ID and the value the timestamp it was posted at.
- These ID's will be evicted after `repost_cache_timeout` minutes of time have passed.

0 comments on commit e8de485

Please sign in to comment.