Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make rotating server announcements editable during runtime #4

Open
marcdif opened this issue Nov 30, 2020 · 0 comments
Open

Make rotating server announcements editable during runtime #4

marcdif opened this issue Nov 30, 2020 · 0 comments

Comments

@marcdif
Copy link
Member

marcdif commented Nov 30, 2020

Currently, the rotating server announcements are stored in announcements.txt in the directory that Dashboard runs. This has worked for a while, but makes it difficult to change the messages. This aims to fix that by storing those announcements in MongoDB and allowing them to be created, edited, and removed with commands.

Commands:

  • /announce create [id] [message] - This command creates a new announcement. The id must be unique (no other announcement may exist with the same case-insensitive id), and the message may contain color codes. By default, announcements are deactivated and are added at the bottom of the list.
  • /announce remove [id] - Delete an existing announcement. This cannot be undone. If you only want to take an announcement out of rotation, consider deactivating it instead of removing it.
  • /announce list - List all existing announcements and all relevant information for each.
  • /announce move [id] [up/down] - Announcements are displayed in a certain, consistent order. This command allows a message to be moved one position up or down in this list. If moving the announcement would put it outside the list (moving up from position 1, moving down from last position), it will be moved to the other end of the list (move down from last position places it in position 1).
  • /announce edit [id] [new message] - Update an existing announcement with a new message. This can be preferred to removing and creating a new announcement, since it wouldn't retain its position.
  • /announce activate [id] - Activate an announcement. The announcement's message will be included in the list of rotating announcements. Announcements are sent to all players on the server every five minutes.
  • /announce deactivate [id] - Deactivate an announcement. The announcement's message will be removed from the list of rotating announcements.

Database Storage:

Announcements are stored in the MongoDB database in the collection announcements with the format:

{
  "id": "safe",
  "message": "&aPlease keep your language &bsafe for little ears.",
  "active": true
}

There will also be one document in the collection that doesn't follow this format - it stores the prefix of all announcements:

{
  "prefix": "&f[&9✦&f] "
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant