moymo,Docs
Skip to content
Bots

Sending messages ​

A bot writes messages as itself, in any text channel where its role gives it View Channel and Send Messages (after the channel's own overwrites). This page is the guide; every field is in the Message reference.

RequestPOST/channels/{channel.id}/messages
bash
curl -X POST https://moymo.net/api/app/v1/channels/$CHANNEL_ID/messages \
  -H "Authorization: Bot $MOYMO_BOT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "content": "Hello from a bot" }'
js
await fetch(`https://moymo.net/api/app/v1/channels/${channelId}/messages`, {
  method: 'POST',
  headers: {
    Authorization: `Bot ${process.env.MOYMO_BOT_TOKEN}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ content: 'Hello from a bot' })
})
python
import os
import requests

requests.post(
    f"https://moymo.net/api/app/v1/channels/{channel_id}/messages",
    headers={"Authorization": f"Bot {os.environ['MOYMO_BOT_TOKEN']}"},
    json={"content": "Hello from a bot"},
)

Text and mentions ​

content is up to 4000 characters of text. Mentions are written as tokens: <@username> for a member, <@&role-id> for a role, @everyone, <#channel-id> for a channel. What may really ping is controlled by allowed_mentions; "allowed_mentions": { "parse": [] } pings nobody. A message may name up to 50 members and 10 roles.

Embeds ​

An embed is a card inside a message: a title, a description, a colour stripe, fields and pictures. A message has up to 10, with up to 6000 characters of text between them.

An embed with fieldsJSON
json
{
  "embeds": [{
    "title": "Friday night",
    "description": "Who is in?",
    "color": 3145582,
    "fields": [
      { "name": "Game", "value": "Hades", "inline": true },
      { "name": "Time", "value": "20:00", "inline": true }
    ],
    "footer": { "text": "React below" }
  }]
}

Pictures are loaded by each member's own program from the address you give, which must be https. Host them somewhere you control. The whole shape and its limits are in the reference.

Game cards ​

Moymo can show a game of its catalogue as a card (cover, title, the Moymo Index, buttons to rate it or put it on a shelf), the same card people send each other. Give the game's slug in game:

A game cardJSON
json
{ "content": "Tonight's pick:", "game": "hades" }

The bot needs Embed Games.

Components ​

Put buttons and menus on the message with components: see Using message components. A press reaches your interactions endpoint.

Replies, reactions, pins ​

  • Reply with reply_to (the id of the message answered).
  • React with a unicode emoji or a server emoji (:name~code:): PUT /channels/{channel}/messages/{message}/reactions/{emoji}/@me.
  • Pin with Manage Messages.
  • Edit and delete your bot's own messages; with Manage Messages it can delete others'.
  • Send twice safely with a nonce: a message with a nonce the bot already used is not written again.

What a bot may read ​

A bot reads the channels its role can see. What other people said is guarded by an intent: without MESSAGE_CONTENT a bot reads its own messages, the ones that mention it and the ones that reply to it. Commands and buttons never need it: the interaction carries what the member chose to send.

Not yet ​

  • Files and pictures on a message a bot sends. Link an https picture in an embed for now.
  • Layout components (containers, sections, galleries).
  • Reading forum posts, to-do lists, documents, polls and calendars; they are on the roadmap.
  • Text of sealed channels: a bot cannot decrypt them; see What a bot is.

The wiki is for Moymo's members and developers. Something wrong or missing? Use "Suggest a change" on any page.