-
Notifications
You must be signed in to change notification settings - Fork 9
API
Kruzya edited this page Dec 6, 2017
·
4 revisions
[Discord] Core provides a really simple API for third-party plugins if they need send some data in Discord.
But remember: Discord have some limitations for WebHooks. Do not send 10 messages in second, for example.
- Discord_StartMessage() - Starts a preparing message for sending in Discord. Do not receives any arguments. You can't start a new message if old not finished or closed.
- Discord_EndMessage(const char, bool) - Finish preparing message and sending in Discord. After this call you can start new message. Accepts two params: webhook name and permission for using default webhook.
- Discord_CancelMessage() - Cancel preparing message. The prepared message will not be sent. After this call you can start new message.
- Discord_SetUsername(const char) - Installs a username for sender. Accepts one param: username.
- Discord_SetAvatar(const char) - Installs a avatar for sender. Accepts one param: URL for new avatar.
- Discord_SetContent(const char, any ...) - Installs a text message. Can accepts multiple params: Formatting rules and arguments for formatting.
- Discord_SetColor(int) - Installs a color for embed object. Accept one param: color in decimal format.
- Discord_SetTitle(const char, const char, any ...) - Installs a new title for embed object. Accepts a multiple params: URL for title (leave empty, if you don't need create link from title), formatting rules for title and arguments for formatting.
- Discord_AddField(const char, const char, bool) - Add a field in embed object. If embed object not created, creates him. Accepts three params: Title for field, text, and flag for inlining with the previous field.
These natives added in v1.0.2
- Discord_WebHookExists(const char) - Checks for webhook availability.
- Discord_ReloadConfig() - Reloads a core webhook configuration.
- Discord_BindWebHook(const char, const char) - Manually setups a webhook URL. This is can be helpful for a plugin-specific webhooks. Also, remember: This function protects already created webhooks. You can't replace existing webhook.
See our examples.