🈷️
Suggester
Easy JSON wrapper modfied to wrok with suggestions.
This was made for small discord bots, for big bots you should not use this.
📥
Usage
Clone this file into your project folder.
Add from suggester import SuggestionBoard
to the top of your project.
📄
Docs
board.add_suggestion(content: str, author: int)
Creates a suggestion in the draft category.
Will return the suggestions ID (sID).
"1234567890": {"content": content, "author": author}
board.approve_suggestion(sID: str)
Moves a suggestion from the draft category to the approved category.
Will raise:
-
NoSuchSuggestion: if there is not a suggestion with that sID.
-
SuggestionAlreadyApproved: if the suggestion was already approved.
-
SuggestionWasRejectedBefore: if the suggestion was rejected earlier.
board.reject_suggestion(sID: str)
Moves a suggestion from the draft category to the rejected category.
Will raise:
-
NoSuchSuggestion: if there is not a suggestion with that sID.
-
SuggestionAlreadyRejected: if the suggestion was already rejected.
-
SuggestionWasApprovedBefore: if the suggestion was approved earlier.
board.search(*args, *, sid=None, funnel="?+-*", author=None)
-
kwargs:
- sid:
If this kwarg is given, it will return the suggestion with the sID while ignoring all other args and kwargs except funnel
- funnel:
Filters suggestions by its status. ?: draft, +: approved, -: rejected.
- author:
Filters suggestions by its author.
- sid:
-
args:
Filters suggestions if all of the args are in the suggestions content.