Difference between revisions of "Manual:Discord Functions"

From Mudlet
Jump to navigation Jump to search
(Documented setDiscordLargeIcon)
(Documented setDiscordLargeIconText)
Line 164: Line 164:
 
==setDiscordLargeIcon==
 
==setDiscordLargeIcon==
 
;setDiscordLargeIcon()
 
;setDiscordLargeIcon()
: Sets the the large icon to be shown in Discord Rich Presence. See [https://discordapp.com/developers/docs/rich-presence/how-to#updating-presence-update-presence-payload-fields Discord docs] for a handy image reference the icon is shown.  
+
: Sets the large icon to be shown in Discord Rich Presence. See [https://discordapp.com/developers/docs/rich-presence/how-to#updating-presence-update-presence-payload-fields Discord docs] for a handy image reference the icon is shown.  
  
 
Icons supported by default in Mudlet: armor, axe, backpack, bow, coin, dagger, envelope, gem-blue, gem-green, gem-red, hammer, heart, helmet, map, shield, tome, tools, wand, wood-sword ([https://opengameart.org/content/fantasy-icon-pack-by-ravenmore-0 icons credit]). To add a new icon to the list, [https://www.mudlet.org/contact/ get in touch] (the Discord limit is 150 icons).
 
Icons supported by default in Mudlet: armor, axe, backpack, bow, coin, dagger, envelope, gem-blue, gem-green, gem-red, hammer, heart, helmet, map, shield, tome, tools, wand, wood-sword ([https://opengameart.org/content/fantasy-icon-pack-by-ravenmore-0 icons credit]). To add a new icon to the list, [https://www.mudlet.org/contact/ get in touch] (the Discord limit is 150 icons).
Line 171: Line 171:
  
 
See also:  
 
See also:  
[[#getDiscordLargeIcon|getDiscordLargeIcon]], [[#setDiscordApplicationID|setDiscordApplicationID]]
+
[[#getDiscordLargeIcon|getDiscordLargeIcon]], [[#setDiscordLargeIconText|setDiscordLargeIconText]], [[#setDiscordApplicationID|setDiscordApplicationID]]
  
 
{{note}} To ensure privacy, the icon will only be shown if the Lua API is enabled and the large icon is not hidden.  
 
{{note}} To ensure privacy, the icon will only be shown if the Lua API is enabled and the large icon is not hidden.  
Line 181: Line 181:
 
setDiscordLargeIcon("coin")
 
setDiscordLargeIcon("coin")
 
setDiscordState("Fishing")
 
setDiscordState("Fishing")
 +
</syntaxhighlight>
 +
 +
==setDiscordLargeIconText==
 +
;setDiscordLargeIconText()
 +
: Sets the tooltip for the large icon in the Discord Rich Presence. See [https://discordapp.com/developers/docs/rich-presence/how-to#updating-presence-update-presence-payload-fields Discord docs] for a handy image reference the large icon is shown.
 +
 +
See also:
 +
[[#setDiscordLargeIcon|setDiscordLargeIcon]]
 +
 +
{{note}} To ensure privacy, the tooltip will only be shown if the Lua API is enabled and neither the large icon nor the large icon tooltip is not hidden.
 +
 +
{{note}} Available since Mudlet 3.14.
 +
 +
;Example
 +
<syntaxhighlight lang="lua">
 +
setDiscordLargeIcon("axe")
 +
setDiscordLargeIconText("Killing heterics")
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 03:04, 24 September 2018

getDiscordDetail

getDiscordDetail()
Returns the text used for the Discord Rich Presence detail field. See Discord docs for a handy image reference on where the detail is shown.

See also: setDiscordDetail

Note Note: Available since Mudlet 3.14

Example
print("Discord detail is: ".. getDiscordDetail())

getDiscordLargeIcon

getDiscordLargeIcon()
Returns the large icon name used for the Discord Rich Presence. See Discord docs for a handy image reference on where the large icon is shown.

See also: setDiscordLargeIcon

Note Note: Available since Mudlet 3.14

Example
print("Discord large icon is: ".. getDiscordLargeIcon())

getDiscordLargeIconText

getDiscordLargeIconText()
Returns the text used as a tooltip for the large icon in the Discord Rich Presence. See Discord docs for a handy image reference on where the large icon is shown.

See also: setDiscordLargeIconText

Note Note: Available since Mudlet 3.14

Example
print("Discord large icon tooltip is: ".. setDiscordLargeIconText())

getDiscordParty

getDiscordParty()
Returns the current and max party values used in the Discord Rich Presence. See Discord docs for a handy image reference on where the the party info is shown.

See also: setDiscordParty

Note Note: Available since Mudlet 3.14

Example
local currentsize, maxsize = getDiscordParty()
print(string.format("Discord party: %d out of %d", currentsize, maxsize))

getDiscordSmallIcon

getDiscordSmallIcon()
Returns the small icon name used for the Discord Rich Presence. See Discord docs for a handy image reference on where the small icon is shown.

See also: setDiscordSmallIcon

Note Note: Available since Mudlet 3.14

Example
print("Discord small icon is: ".. getDiscordSmallIcon())

getDiscordSmallIconText

getDiscordSmallIconText()
Returns the text used as a tooltip for the small icon in the Discord Rich Presence. See Discord docs for a handy image reference on where the small icon is shown.

See also: setDiscordSmallIconText

Note Note: Available since Mudlet 3.14

Example
print("Discord small icon tooltip is: ".. setDiscordSmallIconText())

getDiscordState

getDiscordState()
Returns the text used for the Discord Rich Presence state field. See Discord docs for a handy image reference on where the state is shown.

See also: setDiscordState

Note Note: Available since Mudlet 3.14

Example
print("Discord state is: ".. getDiscordState())

setDiscordApplicationID

setDiscordApplicationID()
Set a custom Discord ID so Discord Rich Presence will show "Playing <your game>" instead of "Playing Mudlet". This function is intended for game authors. Note that you can also set it automatically over GMCP, no pre-installation of scripts required. The Discord privacy option "Enable Lua API" must be enabled for this to work. Returns true if the Discord application ID is in the correct format.

If you're a game author, you can register your game over at Discord to obtain the "client ID" to be used for this function. Once you do so, make sure to upload the games icon as an art asset under the name of server-icon.

Mudlet calls the client ID an application ID to avoid confusion with the Discord's own client.

Mudlet Discord ApplicationID.png

See also: setDiscordGame

Note Note: Available since Mudlet 3.14

Example
-- set the ID to Mudlets own as an example
setDiscordApplicationID("450571881909583884")

setDiscordDetail

setDiscordDetail()
Sets the text to be shown in the detail field of Discord Rich Presence. See Discord docs for a handy image reference on where the defail is shown. Note that this will overwrite the same information set by setDiscordGame().

See also: getDiscordDetail, setDiscordGame

Note Note: Available since Mudlet 3.14

Example
-- set detail to your character name in-game, as an example
setDiscordDetail("Vadi")

setDiscordElapsedStartTime

setDiscordElapsedStartTime()
Sets the time to be shown for "## elapsed" field in Discord Rich Presence. See Discord docs for a handy image reference on where the elapsed time is shown.

Note Note: Available since Mudlet 3.14

Example
-- set the timer to start counting up from now:
setDiscordElapsedStartTime(os.time(os.date("*t")))

setDiscordGame

setDiscordGame()
Sets the given game to be shown in the "detail" field and the game's icon as the large icon in Discord Rich Presence. See Discord docs for a handy image reference on where the detail and large icon is shown. This is an alternative way of showing which game you're playing - a better way, if you're the game author, is to use GMCP (no pre-installation of scripts required) or setDiscordApplicationID().

Currently supported games are: Achaea, Aetolia, Imperian, Luminari, Lusternia, MidMUD, Starmourn, WoTMUD. To add a new game to the list, get in touch.

See also: setDiscordApplicationID

Note Note: Available since Mudlet 3.14

Example
setDiscordGame("WoTMUD")

setDiscordLargeIcon

setDiscordLargeIcon()
Sets the large icon to be shown in Discord Rich Presence. See Discord docs for a handy image reference the icon is shown.

Icons supported by default in Mudlet: armor, axe, backpack, bow, coin, dagger, envelope, gem-blue, gem-green, gem-red, hammer, heart, helmet, map, shield, tome, tools, wand, wood-sword (icons credit). To add a new icon to the list, get in touch (the Discord limit is 150 icons).

If you're a game author, you can register your own game with Discord and upload your own icons instead of using the ones registered by Mudlet, see setDiscordApplicationID().

See also: getDiscordLargeIcon, setDiscordLargeIconText, setDiscordApplicationID

Note Note: To ensure privacy, the icon will only be shown if the Lua API is enabled and the large icon is not hidden.

Note Note: Available since Mudlet 3.14.

Example
setDiscordLargeIcon("coin")
setDiscordState("Fishing")

setDiscordLargeIconText

setDiscordLargeIconText()
Sets the tooltip for the large icon in the Discord Rich Presence. See Discord docs for a handy image reference the large icon is shown.

See also: setDiscordLargeIcon

Note Note: To ensure privacy, the tooltip will only be shown if the Lua API is enabled and neither the large icon nor the large icon tooltip is not hidden.

Note Note: Available since Mudlet 3.14.

Example
setDiscordLargeIcon("axe")
setDiscordLargeIconText("Killing heterics")