Adding a bot to a server
A bot is added with the OAuth2 bot scope: a link opens Moymo's consent page, the person picks a server and the permissions, and Moymo does the rest.
The link
The install linkText
text
https://moymo.net/oauth2/authorize?client_id=<application id>&scope=bot&permissions=<number>| Parameter | |
|---|---|
client_id | Your application's id. |
scope | bot. You can add other scopes (identify bot); then the member's browser is sent back to your redirect address with a code too, as in the OAuth2 guide. |
permissions | The permissions the bot asks for, as one number: the sum of the permission bits. 7 is View channels + Send messages + Read message history. Leave it out to use the default you saved on the Installation tab. |
server_id | Optional. Preselects a server in the picker. |
redirect_uri | Optional for a link that only adds a bot. |
The portal's Installation tab and the OAuth2 URL generator build the link for you; tick the permissions and copy.
What the person sees
The consent page shows your application's name, picture and summary, who made it, its verified domain if it has one, and a notice if it is a draft. For a bot it adds:
- a server picker: the servers where the person has Manage Server (a server's owner always has it);
- the permissions the link asked for, as checkboxes, all ticked. They can untick any.
They choose Authorise. If your link has no redirect address, they see "Bot added" and a button back to Moymo; if it has one, their browser is sent there with server_id=<id> (and a code if you asked for more scopes than bot).
What Moymo does
- Checks that the person may add this bot: the application is not suspended; a draft is added by its owner and testers only; a published one by anybody if the bot is public, and by owner and testers if not.
- Checks that the person may manage the server, and gives the bot only what the person holds themselves: a person with Manage Server and Send messages cannot hand a bot Ban members. A server's owner and a member with Administrator can give any permission.
- Adds the bot to the server as a member. It is a member until someone removes it.
- Makes a managed role named after your application, with exactly the granted permissions, and gives it to the bot. The role sits just below the highest role of the person who added the bot, so a bot is never above the person who added it. Roles from there up make room.
- Tells the server, if it has a channel for join notices (a server setting; see Servers): a line there says the bot was added, and by whom.
The role belongs to the application: only an install changes it (adding the bot again with other permissions narrows or widens the same role), and it is deleted when the application is.
Adding it again
Using the link on a server where the bot already is updates its role: the permissions become what was chosen this time. That is how a server owner changes what a bot may do; they can also edit permissions by channel in the usual overwrites, which apply to a bot like to anyone.
Limits
- A draft application's bot can be in 25 servers.
- A server has up to 100 roles and 2000 members; the install says so if there is no room.
- A bot that is banned from a server cannot be added to it until it is unbanned.
Removing a bot
Kick it like any member (Kick on its card) or ban it. Its managed role stays until the application is deleted; deleting the role is also possible in the server's roles page once the bot is gone.