What Is a Write?
A write is any request that creates or changes something, such as creating a log, starting a shift or approving an LOA. Writes use POST, PATCH or DELETE.
Every Write Has a Staff Member Behind It
Your token says which server you're working in, but not who's doing the work. So every write names a staff member, and runs as if they did it themselves in Melonly.
| Field | Used by |
|---|---|
createdBy | Create a Log |
issuedBy | Issue an Infraction, Suspend a Member |
memberId | Things members do for themselves, such as Start a Shift and Submit an LOA |
performedBy | Everything else, such as editing logs, ending someone's shift or approving an LOA |
The staff member has to be a member of your server, or of the department for department writes. Use Get a Member by Discord ID to find their member ID.
Their Permissions Apply
The staff member needs the same permissions they'd need in the dashboard. For example, creating a ban needs the Ban permission, and ending someone else's shift needs Manage Shifts and a higher role than them.
If they're not allowed, you get a 403 with the code forbidden. This keeps your bot from doing anything your staff couldn't do themselves, so it's a good idea to pass the person who ran the bot command, not an admin account.
Your server's settings apply too. If you require staff to be on shift to create logs, the API enforces that as well.
Everything Else Happens Too
Because writes run exactly like they do in Melonly, all the usual things happen:
| When you | Melonly also |
|---|---|
| Create a log | Posts it to your log channel, DMs the player, PMs them in game for warnings, completes their ban BOLO for bans, and creates an automatic ban BOLO if they hit your limit |
| Start or end a shift | Gives or removes the Discord shift role and nickname prefix, and posts to your shift channel |
| Issue an infraction | Updates point roles, starts automatic suspensions or terminations, and DMs the member |
| Submit or review an LOA | Posts to your LOA channel, gives or removes the LOA role and DMs the member |
| Approve or deny an application | Sends the result, changes roles and DMs the applicant |
Workflows and audit logs run as usual too.
Writes Can Take a Few Seconds
Some writes wait for Discord, such as sending a log message. Allow up to 30 seconds before giving up.
If a write fails with a 502 or times out, it may still have happened. Check before trying again, so you don't create something twice. See When a Write Fails.
Where to Go Next
Need help?
Still have questions? Join our Discord server for support from the Melonly Team.