This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
discordchat [2019/04/04 05:11] – instructions first pass mochi | discordchat [2019/04/22 09:13] (current) – [Custom Commands] mochi | ||
---|---|---|---|
Line 7: | Line 7: | ||
!l3 Hello. | !l3 Hello. | ||
</ | </ | ||
+ | |||
+ | Anything you message in Discord that starts with //!// will be processed as a FF14 chatbox input. //!l3 Hello// becomes ///l3 Hello// | ||
+ | |||
+ | === Important Notes === | ||
+ | * There may be up to a 2 second delay in sending messages from FF14 to Discord, and up to a 4 second delay in sending messages from Discord to FF14. | ||
+ | * Please follow all these instructions to set up the addon. **You can do all these setup steps without buying/ | ||
+ | * Auto-Translate phrases are not sent. | ||
+ | * [[http:// | ||
+ | ---- | ||
+ | {{:: | ||
+ | ---- | ||
====== Opening the Discord Chat Addon Window ====== | ====== Opening the Discord Chat Addon Window ====== | ||
The Discord Chat Plug-in window is under the FFXIVMinion menu. | The Discord Chat Plug-in window is under the FFXIVMinion menu. | ||
+ | ---- | ||
+ | {{: | ||
- | Creating a Discord Server and Channel | + | ====== |
You will likely want a private server for this plug-in, for your own privacy. | You will likely want a private server for this plug-in, for your own privacy. | ||
- | - See [[https:// | + | |
- | - Optionally, create a separate channel for your bot to use. | + | - Optionally, create a separate channel for your bot to use. |
- | - Get the channel ID of the channel you'd like to use. | + | - Get the channel ID of the channel you'd like to use. |
- | - In Discord, open your User Settings. Under Appearance, make sure Enable Developer Mode is checked on. | + | - In Discord, open your //User Settings//. Under //Appearance//, make sure //Enable Developer Mode// is checked on. |
- | - Right-click on the Discord text channel you would like to use, and press Copy ID. This will copy the channel ID to your clipboard. | + | - Right-click on the Discord text channel you would like to use, and press //Copy ID//. This will copy the channel ID to your clipboard. |
- | - Paste the ID into MMOMinion' | + | - Paste the ID into MMOMinion' |
+ | |||
+ | {{:: | ||
====== Creating a Bot and Receiving a Token ===== | ====== Creating a Bot and Receiving a Token ===== | ||
- | Create a bot starting [[https:// | + | - Create a bot starting [[https:// |
+ | - Log in and click //New Application// | ||
+ | - Choose anything you want a name. Something like //FF14 Chatbot// is appropriate. | ||
+ | - On the left side, under // | ||
+ | - Under // | ||
+ | - Optionally, configure your bot's username here. | ||
+ | - Under //Token//, click //Copy// to copy the token to your clipboard. | ||
+ | - Paste the bot token into the //Discord Chat// addon in MMOMinion, under //Bot Token/ | ||
+ | - On the left side, go to //OAuth2//. Scroll down to //Scopes// and check //bot//. | ||
+ | - Scroll down to //Bot Permissions// | ||
+ | - Copy the URL under the checkboxes in //Scopes// and visit the URL in your clipboard. | ||
+ | - Log-in to discord and authorize the bot to join your server. | ||
+ | - Activate the bot token, in the next section. | ||
- | - Log in and click //New Application// | + | {{:: |
- | - Choose anything you want a name. Something like //FF14 Chatbot// is appropriate. | + | |
- | - On the left side, under // | + | |
- | - Under // | + | |
- | - Optionally, configure your bot's username here. | + | |
- | - Under //Token//, click //Copy// to copy the token to your clipboard. | + | |
- | - Paste the bot token into the //Discord Chat// addon in MMOMinion, under //Bot Token/ | + | |
- | - On the left side, go to //OAuth2//. Scroll down to //Scopes// and check //bot//. | + | |
- | - Copy the URL under the checkboxes in //Scopes// and visit the URL in your clipboard. | + | |
- | - Log-in to discord and authorize the bot to join your server. | + | |
- | - Activate the bot token, in the next section. | + | |
====== Activating the Bot Token ====== | ====== Activating the Bot Token ====== | ||
- | Each bot token needs to be activated once it's created, before it can be used by the //Discord Chat// addon. This only needs to be done once. | + | Each bot token needs to be activated once it's created, before it can be used by the //Discord Chat// addon. This only needs to be done once. This is to allow the token to send messages to the server, and the activation form below only sends your token to Discord. |
- | Paste the token into the form below, then hit // | + | Paste the token into the form below, then hit // |
< | < | ||
< | < | ||
Line 90: | Line 107: | ||
<div id=" | <div id=" | ||
</ | </ | ||
+ | |||
+ | ====== Configuring the Bot ====== | ||
+ | Under // | ||
+ | |||
+ | Under // | ||
+ | |||
+ | * **Autostart**: | ||
+ | * **Command Prefix**: Defaulted to //!//. The prefix to commands the bot will listen to. | ||
+ | * **Timestamp Format**: Defaulted to //%H:%M//. The format of the timestamp sent to discord for in-game messages. | ||
+ | * **Send Channel Name**: Defaulted to //on//. Sends the name of the channel to discord for in-game messages. | ||
+ | * **Receive From Discord**: Defaulted to //on//. Listens for messages in the discord channel. | ||
+ | * **Send To Discord**: Defaulted to //on//. Sends messages from in-game to the discord channel. | ||
+ | * **Logging Level**: Defaulted to //0//. Increasing this will show more debug statements in console. | ||
+ | |||
+ | When an external addon registers itself with // | ||
+ | |||
+ | ====== Advanced Channel Configuration ====== | ||
+ | You can configure the addon to send messages in different chat channels in FF14 (such as Say, FC, LS1, LS4) to go to a different channel in Discord. | ||
+ | |||
+ | You can create multiple channels in your Discord server, //Copy ID// in Discord, and paste them in the Channels configuration window. | ||
+ | |||
+ | {{:: | ||
+ | |||
+ | You can also specify a hex color to distinguish between messages. For example, //ff0000// would give a red color, and //00ff00// would give a green color. You can use [[https:// | ||
+ | |||
+ | {{:: | ||
+ | |||
+ | If you enable // | ||
+ | |||
+ | |||
+ | ====== Mention Keywords ====== | ||
+ | You can specify specific keywords, that when said in chat, will notify you in discord with an //@// mention. These can be found under the //Bot Token/ | ||
+ | |||
+ | |||
+ | {{:: | ||
+ | |||
+ | |||
+ | ====== Custom Commands ====== | ||
+ | If you want to program your own commands and responses, you can program simple ones with custom commands. (You can more easily make complex ones using the public API in the next section.) | ||
+ | |||
+ | Under //Custom Commands//, define a prefix, and a response. A return value will be send back to the channel the command was sent in. There are two additional commands you can use, //message// and // | ||
+ | |||
+ | Here are two examples: | ||
+ | |||
+ | **Returns your current HP** | ||
+ | |||
+ | Prefix: hp | ||
+ | |||
+ | Code: <code lua> | ||
+ | |||
+ | **Returns your current map and position** | ||
+ | |||
+ | Prefix: pos | ||
+ | |||
+ | Code: <code lua> | ||
+ | |||
+ | {{:: | ||
====== Public API for Other Addons ====== | ====== Public API for Other Addons ====== | ||
- | Other plugins can send messages and listen for messages through a public API. With // | + | Other plugins can send messages and listen for messages through a public API. With // |
Here's an example addon that sends and listens for commands. | Here's an example addon that sends and listens for commands. | ||
Line 126: | Line 200: | ||
test_discord_plugin.SendMessage = discord_chat_api.Register( | test_discord_plugin.SendMessage = discord_chat_api.Register( | ||
"test discord plugin", | "test discord plugin", | ||
+ | else | ||
+ | test_discord_plugin.SendMessage = function(message) | ||
+ | d(" | ||
+ | end | ||
end | end | ||
end | end | ||
Line 139: | Line 217: | ||
GUI: | GUI: | ||
test_discord_plugin.visible, | test_discord_plugin.visible, | ||
- | "Test Discord Chat", | + | "Test Discord Chat", test_discord_plugin.gui_open) |
- | | + | |
if test_discord_plugin.visible then | if test_discord_plugin.visible then | ||
local pushed = GUI: | local pushed = GUI: | ||
Line 154: | Line 231: | ||
end | end | ||
- | RegisterEventHandler(" | + | RegisterEventHandler(" |
- | | + | |
RegisterEventHandler(" | RegisterEventHandler(" | ||
</ | </ | ||
+ | The message passed into your registered callback looks something like this: | ||
+ | <code lua> | ||
+ | { | ||
+ | attachments = | ||
+ | { | ||
+ | }, | ||
+ | author = | ||
+ | { | ||
+ | avatar = " | ||
+ | discriminator = " | ||
+ | id = " | ||
+ | username = " | ||
+ | }, | ||
+ | channel_id = " | ||
+ | content = "!test message", | ||
+ | embeds = | ||
+ | { | ||
+ | }, | ||
+ | id = " | ||
+ | mention_everyone = false, | ||
+ | mention_roles = | ||
+ | { | ||
+ | }, | ||
+ | mentions = | ||
+ | { | ||
+ | }, | ||
+ | pinned = false, | ||
+ | timestamp = " | ||
+ | tts = false, | ||
+ | type = 0, | ||
+ | } | ||
+ | |||
+ | </ |