Difference between revisions of "Manual:Discord Functions"

From Mudlet
Jump to navigation Jump to search
(Marked this version for translation)
m (Reverted edits by TheFae (talk) to last revision by Vadi)
Tag: Rollback
Line 1: Line 1:
{{TOC right}}
 
 
<languages/>
 
<languages/>
<translate><!--T:1--> For an overview on how all of these functions tie in together, see our [[Special:MyLanguage/Manual:Scripting#Discord_Rich_Presence|Discord scripting overview]].</translate>
+
<translate>
 +
For an overview on how all of these functions tie in together, see our [[Special:MyLanguage/Manual:Scripting#Discord_Rich_Presence|Discord scripting overview]].
  
  
 +
</translate>
 
<span id="getdiscorddetail"></span>
 
<span id="getdiscorddetail"></span>
 +
<translate>
 
==getDiscordDetail==
 
==getDiscordDetail==
  
 
;getDiscordDetail()
 
;getDiscordDetail()
: <translate><!--T:2--> Returns the text used for the Discord Rich Presence detail field. See [https://discordapp.com/developers/docs/rich-presence/how-to#updating-presence-update-presence-payload-fields Discord docs] for a handy image reference on where the detail is shown.</translate>
+
: Returns the text used for the Discord Rich Presence detail field. See [https://discordapp.com/developers/docs/rich-presence/how-to#updating-presence-update-presence-payload-fields Discord docs] for a handy image reference on where the detail is shown.
  
<translate><!--T:3--> See also: </translate>
+
See also:  
[[#setdiscorddetail|setDiscordDetail]]
+
[[Special:MyLanguage/#setdiscorddetail|setDiscordDetail]]
  
{{note}} <translate><!--T:4--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14
  
;<translate><!--T:5--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
print("<translate><!--T:6--> Discord detail is: </translate>".. getDiscordDetail())
+
print("Discord detail is: ".. getDiscordDetail())
 
</syntaxhighlight>
 
</syntaxhighlight>
  
  
 +
</translate>
 
<span id="getdiscordlargeicon"></span>
 
<span id="getdiscordlargeicon"></span>
 +
<translate>
 
==getDiscordLargeIcon==
 
==getDiscordLargeIcon==
  
 
;getDiscordLargeIcon()
 
;getDiscordLargeIcon()
: <translate><!--T:7--> Returns the large icon name used for 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 on where the large icon is shown.</translate>
+
: Returns the large icon name used for 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 on where the large icon is shown.
  
<translate><!--T:8--> See also: </translate>
+
See also:  
[[#setdiscordlargeicon|setDiscordLargeIcon]]
+
[[Special:MyLanguage/#setdiscordlargeicon|setDiscordLargeIcon]]
  
{{note}} <translate><!--T:9--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14
  
;<translate><!--T:10--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
print("<translate><!--T:11--> Discord large icon is: </translate>".. getDiscordLargeIcon())
+
print("Discord large icon is: ".. getDiscordLargeIcon())
 
</syntaxhighlight>
 
</syntaxhighlight>
  
  
<span id="getdiscordlargeicontext"></span>
 
 
==getDiscordLargeIconText==
 
==getDiscordLargeIconText==
  
 
;getDiscordLargeIconText()
 
;getDiscordLargeIconText()
: <translate><!--T:12--> Returns the text used as a 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 on where the large icon is shown.</translate>
+
: Returns the text used as a 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 on where the large icon is shown.
  
<translate><!--T:13--> See also: </translate>
+
See also:  
[[#setdiscordlargeicontext|setDiscordLargeIconText]]
+
[[Special:MyLanguage/#setdiscordlargeicontext|setDiscordLargeIconText]]
  
{{note}} <translate><!--T:14--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14
  
;<translate><!--T:15--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
print("<translate><!--T:16--> Discord large icon tooltip is: </translate>".. setDiscordLargeIconText())
+
print("Discord large icon tooltip is: ".. setDiscordLargeIconText())
 
</syntaxhighlight>
 
</syntaxhighlight>
  
  
 +
</translate>
 
<span id="getdiscordparty"></span>
 
<span id="getdiscordparty"></span>
 +
<translate>
 
==getDiscordParty==
 
==getDiscordParty==
  
 
;getDiscordParty()
 
;getDiscordParty()
: <translate><!--T:17--> Returns the current and max party values used 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 on where the the party info is shown.</translate>
+
: Returns the current and max party values used 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 on where the the party info is shown.
  
<translate><!--T:18--> See also: </translate>
+
See also:  
[[#setdiscordparty|setDiscordParty]]
+
[[Special:MyLanguage/#setdiscordparty|setDiscordParty]]
  
{{note}} <translate><!--T:19--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14
  
;<translate><!--T:20--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
local currentsize, maxsize = getDiscordParty()
 
local currentsize, maxsize = getDiscordParty()
print(string.format("<translate><!--T:21--> Discord party: %d out of %d</translate>", currentsize, maxsize))
+
print(string.format("Discord party: %d out of %d", currentsize, maxsize))
 
</syntaxhighlight>
 
</syntaxhighlight>
  
  
 
+
</translate>
 
<span id="getdiscordsmallicon"></span>
 
<span id="getdiscordsmallicon"></span>
 +
<translate>
 
==getDiscordSmallIcon==
 
==getDiscordSmallIcon==
  
 
;getDiscordSmallIcon()
 
;getDiscordSmallIcon()
: <translate><!--T:22--> Returns the small icon name used for 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 on where the small icon is shown.</translate>
+
: Returns the small icon name used for 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 on where the small icon is shown.
  
<translate><!--T:23--> See also: </translate>
+
See also:  
[[#setdiscordsmallicon|setDiscordSmallIcon]]
+
[[Special:MyLanguage/#setdiscordsmallicon|setDiscordSmallIcon]]
  
{{note}} <translate><!--T:24--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14
  
;<translate><!--T:25--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
print("<translate><!--T:26--> Discord small icon is: </translate>".. getDiscordSmallIcon())
+
print("Discord small icon is: ".. getDiscordSmallIcon())
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 94: Line 110:
  
 
;getDiscordSmallIconText()
 
;getDiscordSmallIconText()
: <translate><!--T:27--> Returns the text used as a tooltip for the small 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 on where the small icon is shown.</translate>
+
: Returns the text used as a tooltip for the small 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 on where the small icon is shown.
  
<translate><!--T:28--> See also: </translate>
+
See also:  
[[#setdiscordsmallicontext|setDiscordSmallIconText]]
+
[[Special:MyLanguage/#setdiscordsmallicontext|setDiscordSmallIconText]]
  
{{note}} <translate><!--T:29--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14
  
;<translate><!--T:30--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
print("<translate><!--T:31--> Discord small icon tooltip is: </translate>".. setDiscordSmallIconText())
+
print("Discord small icon tooltip is: ".. setDiscordSmallIconText())
 
</syntaxhighlight>
 
</syntaxhighlight>
  
  
 +
</translate>
 
<span id="getdiscordstate"></span>
 
<span id="getdiscordstate"></span>
 +
<translate>
 
==getDiscordState==
 
==getDiscordState==
  
 
;getDiscordState()
 
;getDiscordState()
: <translate><!--T:32--> Returns the text used for the Discord Rich Presence state field. See [https://discordapp.com/developers/docs/rich-presence/how-to#updating-presence-update-presence-payload-fields Discord docs] for a handy image reference on where the state is shown.</translate>
+
: Returns the text used for the Discord Rich Presence state field. See [https://discordapp.com/developers/docs/rich-presence/how-to#updating-presence-update-presence-payload-fields Discord docs] for a handy image reference on where the state is shown.
  
<translate><!--T:33--> See also: </translate>
+
See also:  
[[#setdiscordstate|setDiscordState]]
+
[[Special:MyLanguage/#setdiscordstate|setDiscordState]]
  
{{note}} <translate><!--T:34--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14
  
;<translate><!--T:35--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
print("<translate><!--T:36--> Discord state is: </translate>".. getDiscordState())
+
print("Discord state is: ".. getDiscordState())
 
</syntaxhighlight>
 
</syntaxhighlight>
  
  
 +
</translate>
 
<span id="setdiscordapplicationid"></span>
 
<span id="setdiscordapplicationid"></span>
 +
<translate>
 
==setDiscordApplicationID==
 
==setDiscordApplicationID==
  
 
;setDiscordApplicationID(id)
 
;setDiscordApplicationID(id)
: <translate><!--T:37--> 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 [[Standards:Discord GMCP|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.</translate>
+
: 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 [[Standards:Discord GMCP|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.
  
<translate><!--T:38--> If you're a game author, you can register your game [https://discordapp.com/developers/applications/ 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 <code>server-icon</code>.</translate>
+
If you're a game author, you can register your game [https://discordapp.com/developers/applications/ 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 <code>server-icon</code>.
  
<translate><!--T:39--> Mudlet calls the client ID an application ID to avoid confusion with the Mudlet internal Discord client ID.</translate>
+
Mudlet calls the client ID an application ID to avoid confusion with the Discord's own client.
  
;<translate><!--T:40--> Parameters </translate>
+
;Parameters  
* ''id:'' <translate><!--T:41--> (required) id as a string.</translate>
+
* ''id:'' (required) id as a string.
  
 
[[File:Mudlet Discord ApplicationID.png|thumb|right]]
 
[[File:Mudlet Discord ApplicationID.png|thumb|right]]
  
<translate><!--T:42--> See also: </translate>
+
See also:  
[[#setdiscordgame|setDiscordGame]], [[#usingmudletsdiscordid|usingMudletsDiscordID]]
+
[[Special:MyLanguage/#setdiscordgame|setDiscordGame]], [[Special:MyLanguage/#usingmudletsdiscordid|usingMudletsDiscordID]]
  
{{note}} <translate><!--T:43--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14
  
;<translate><!--T:44--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
-- <translate><!--T:45--> set the ID to Mudlets own as an example</translate>
+
-- set the ID to Mudlets own as an example
 
setDiscordApplicationID("450571881909583884")
 
setDiscordApplicationID("450571881909583884")
 
</syntaxhighlight>
 
</syntaxhighlight>
  
{{note}} <translate><!--T:46--> So you do not have to remember that long number you can also reset to the default Mudlet ID by calling this function without an argument:</translate>
+
</translate>
 +
{{note}}
 +
<translate> So you do not have to remember that long number you can also reset to the default Mudlet ID by calling this function without an argument:
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
setDiscordApplicationID()
 
setDiscordApplicationID()
Line 156: Line 184:
  
  
 +
</translate>
 
<span id="setdiscorddetail"></span>
 
<span id="setdiscorddetail"></span>
 +
<translate>
 
==setDiscordDetail==
 
==setDiscordDetail==
  
 
;setDiscordDetail()
 
;setDiscordDetail()
: <translate><!--T:47--> Sets the text to be shown in the detail field of 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 on where the detail is shown. Note that this will overwrite the same information set by [[#setdiscordgame|setDiscordGame()]].</translate>
+
: Sets the text to be shown in the detail field of 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 on where the detail is shown. Note that this will overwrite the same information set by [[Special:MyLanguage/#setdiscordgame|setDiscordGame()]].
  
<translate><!--T:48--> See also: </translate>
+
See also:  
[[#getdiscorddetail|getDiscordDetail]], [[#setdiscordgame|setDiscordGame]]
+
[[Special:MyLanguage/#getdiscorddetail|getDiscordDetail]], [[Special:MyLanguage/#setdiscordgame|setDiscordGame]]
  
{{note}} <translate><!--T:49--> To ensure privacy, the detail will only be shown if the Lua API is enabled and the detail is not hidden.</translate>
+
</translate>
 +
{{note}}
 +
<translate> To ensure privacy, the detail will only be shown if the Lua API is enabled and the detail is not hidden.
  
{{note}} <translate><!--T:50--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14
  
;<translate><!--T:51--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
-- <translate><!--T:52--> set detail to your character name in-game, as an example</translate>
+
-- set detail to your character name in-game, as an example
 
setDiscordDetail("Vadi")
 
setDiscordDetail("Vadi")
 
</syntaxhighlight>
 
</syntaxhighlight>
  
  
 +
</translate>
 
<span id="setdiscordelapsedstarttime"></span>
 
<span id="setdiscordelapsedstarttime"></span>
 +
<translate>
 
==setDiscordElapsedStartTime==
 
==setDiscordElapsedStartTime==
  
 
;setDiscordElapsedStartTime(time)
 
;setDiscordElapsedStartTime(time)
: <translate><!--T:53--> Sets the time to be shown for "## elapsed" field 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 on where the elapsed time is shown.</translate>
+
: Sets the time to be shown for "## elapsed" field 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 on where the elapsed time is shown.
  
;<translate><!--T:54--> Parameters </translate>
+
;Parameters  
* ''time:'' <translate><!--T:55--> (required) time as a [https://en.wikipedia.org/wiki/Unix_time Unix time]. To get the current Unix time in Lua, use <code>os.time(os.date("*t"))</code>.</translate>
+
* ''time:'' (required) time as a [https://en.wikipedia.org/wiki/Unix_time Unix time]. To get the current Unix time in Lua, use <code>os.time(os.date("*t"))</code>.
  
<translate><!--T:56--> See also: </translate>
+
See also:  
[[#setdiscordremainingendtime|setDiscordRemainingEndTime]]
+
[[Special:MyLanguage/#setdiscordremainingendtime|setDiscordRemainingEndTime]]
  
{{note}} <translate><!--T:57--> To ensure privacy, the time will only be shown if the Lua API is enabled and the time is not hidden.</translate>
+
</translate>
 +
{{note}}
 +
<translate> To ensure privacy, the time will only be shown if the Lua API is enabled and the time is not hidden.
  
{{note}} <translate><!--T:58--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14
  
;<translate><!--T:59--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
-- <translate><!--T:60--> set the timer to start counting up from now:</translate>
+
-- set the timer to start counting up from now:
 
setDiscordElapsedStartTime(os.time(os.date("*t")))
 
setDiscordElapsedStartTime(os.time(os.date("*t")))
 
</syntaxhighlight>
 
</syntaxhighlight>
  
  
 +
</translate>
 
<span id="setdiscordgame"></span>
 
<span id="setdiscordgame"></span>
 +
<translate>
 
==setDiscordGame==
 
==setDiscordGame==
  
 
;setDiscordGame()
 
;setDiscordGame()
: <translate><!--T:61--> 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 [https://discordapp.com/developers/docs/rich-presence/how-to#updating-presence-update-presence-payload-fields 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 [[Standards:Discord GMCP|GMCP]] (no pre-installation of scripts required) or [[#setdiscordapplicationid|setDiscordApplicationID()]].</translate>
+
: 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 [https://discordapp.com/developers/docs/rich-presence/how-to#updating-presence-update-presence-payload-fields 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 [[Standards:Discord GMCP|GMCP]] (no pre-installation of scripts required) or [[Special:MyLanguage/#setdiscordapplicationid|setDiscordApplicationID()]].
  
<translate><!--T:62--> Currently supported games are: Achaea, Aetolia, Imperian, Luminari, Lusternia, MidMUD, Starmourn, WoTMUD. To add a new game to the list, [https://www.mudlet.org/contact/ get in touch].</translate>
+
Currently supported games are: Achaea, Aetolia, Imperian, Luminari, Lusternia, MidMUD, Starmourn, WoTMUD. To add a new game to the list, [https://www.mudlet.org/contact/ get in touch].
  
<translate><!--T:63--> See also: </translate>
+
See also:  
[[#setdiscordapplicationid|setDiscordApplicationID]]
+
[[Special:MyLanguage/#setdiscordapplicationid|setDiscordApplicationID]]
  
{{note}} <translate><!--T:64--> To ensure privacy, the game and icon will only be shown if the Lua API is enabled, and detail and large icon are set to show.</translate>
+
</translate>
 +
{{note}}
 +
<translate> To ensure privacy, the game and icon will only be shown if the Lua API is enabled, and detail and large icon are set to show.
  
{{note}} <translate><!--T:65--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14
  
;<translate><!--T:66--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
setDiscordGame("WoTMUD")
 
setDiscordGame("WoTMUD")
Line 220: Line 266:
  
  
 +
</translate>
 
<span id="setdiscordlargeicon"></span>
 
<span id="setdiscordlargeicon"></span>
 +
<translate>
 
==setDiscordLargeIcon==
 
==setDiscordLargeIcon==
  
 
;setDiscordLargeIcon()
 
;setDiscordLargeIcon()
: <translate><!--T:67--> 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.</translate>
+
: 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.  
  
<translate><!--T:68--> 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).</translate>
+
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).
  
<translate><!--T:69--> 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|setDiscordApplicationID()]].</translate>
+
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 [[Special:MyLanguage/#setdiscordapplicationid|setDiscordApplicationID()]].
  
<translate><!--T:70--> See also: </translate>
+
See also:  
[[#getdiscordlargeicon|getDiscordLargeIcon]], [[#setdiscordlargeicontext|setDiscordLargeIconText]], [[#setdiscordapplicationid|setDiscordApplicationID]]
+
[[Special:MyLanguage/#getdiscordlargeicon|getDiscordLargeIcon]], [[Special:MyLanguage/#setdiscordlargeicontext|setDiscordLargeIconText]], [[Special:MyLanguage/#setdiscordapplicationid|setDiscordApplicationID]]
  
{{note}} <translate><!--T:71--> To ensure privacy, the icon will only be shown if the Lua API is enabled and the large icon is not hidden.</translate>
+
</translate>
 +
{{note}}
 +
<translate> To ensure privacy, the icon will only be shown if the Lua API is enabled and the large icon is not hidden.
  
{{note}} <translate><!--T:72--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14.
  
;<translate><!--T:73--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
setDiscordLargeIcon("coin")
 
setDiscordLargeIcon("coin")
setDiscordLargeIconText("<translate><!--T:74--> Fishing</translate>")
+
setDiscordLargeIconText("Fishing")
setDiscordState("<translate><!--T:75--> Fishing</translate>")
+
setDiscordState("Fishing")
 
</syntaxhighlight>
 
</syntaxhighlight>
  
  
 +
</translate>
 
<span id="setdiscordlargeicontext"></span>
 
<span id="setdiscordlargeicontext"></span>
 +
<translate>
 
==setDiscordLargeIconText==
 
==setDiscordLargeIconText==
  
 
;setDiscordLargeIconText()
 
;setDiscordLargeIconText()
: <translate><!--T:76--> 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.</translate>
+
: 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.  
  
<translate><!--T:77--> See also: </translate>
+
See also:  
[[#setdiscordlargeicon|setDiscordLargeIcon]]
+
[[Special:MyLanguage/#setdiscordlargeicon|setDiscordLargeIcon]]
  
{{note}} <translate><!--T:78--> To ensure privacy, the tooltip will only be shown if the Lua API is enabled, and large icon with the large icon tooltip is set to show.</translate>
+
</translate>
 +
{{note}}
 +
<translate> To ensure privacy, the tooltip will only be shown if the Lua API is enabled, and large icon with the large icon tooltip is set to show.  
  
{{note}} <translate><!--T:79--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14.
  
;<translate><!--T:80--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
setDiscordLargeIcon("axe")
 
setDiscordLargeIcon("axe")
setDiscordLargeIconText("<translate><!--T:81--> Killing heterics</translate>")
+
setDiscordLargeIconText("Killing heterics")
 
</syntaxhighlight>
 
</syntaxhighlight>
  
  
 +
</translate>
 
<span id="setdiscordparty"></span>
 
<span id="setdiscordparty"></span>
 +
<translate>
 
==setDiscordParty==
 
==setDiscordParty==
  
 
;setDiscordParty(current, max)
 
;setDiscordParty(current, max)
: <translate><!--T:82--> Sets the party information 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 party is shown.</translate>
+
: Sets the party information 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 party is shown.
  
;<translate><!--T:83--> Parameters </translate>
+
;Parameters  
* ''current:'' <translate><!--T:84--> (required) current party amount.</translate>
+
* ''current:'' (required) current party amount.
* ''max:'' <translate><!--T:85--> (optional) max party amount - if not provided, then the max is set to the current amount.</translate>
+
* ''max:'' (optional) max party amount - if not provided, then the max is set to the current amount.
  
<translate><!--T:86--> See also: </translate>
+
See also:  
[[#getdiscordparty|getDiscordParty]]
+
[[Special:MyLanguage/#getdiscordparty|getDiscordParty]]
  
{{note}} <translate><!--T:87--> To ensure privacy, the party will only be shown if the Lua API is enabled and the party information is not hidden.</translate>
+
</translate>
 +
{{note}}
 +
<translate> To ensure privacy, the party will only be shown if the Lua API is enabled and the party information is not hidden.  
  
{{note}} <translate><!--T:88--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14.
  
;<translate><!--T:89--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
-- <translate><!--T:90--> show that 5 out of 10 people are in currently in the party</translate>
+
-- show that 5 out of 10 people are in currently in the party
 
setDiscordParty(5, 10)
 
setDiscordParty(5, 10)
 
</syntaxhighlight>
 
</syntaxhighlight>
  
  
 +
</translate>
 
<span id="setdiscordremainingendtime"></span>
 
<span id="setdiscordremainingendtime"></span>
 +
<translate>
 
==setDiscordRemainingEndTime==
 
==setDiscordRemainingEndTime==
  
 
;setDiscordRemainingEndTime(time)
 
;setDiscordRemainingEndTime(time)
: <translate><!--T:91--> Sets the time to be shown for "## remaining" field 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 on where the remaining time is shown.</translate>
+
: Sets the time to be shown for "## remaining" field 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 on where the remaining time is shown.
  
;<translate><!--T:92--> Parameters </translate>
+
;Parameters  
* ''time:'' <translate><!--T:93--> (required) time as a [https://en.wikipedia.org/wiki/Unix_time Unix time]. To get the current Unix time in Lua, use <code>os.time(os.date("*t"))</code>.</translate>
+
* ''time:'' (required) time as a [https://en.wikipedia.org/wiki/Unix_time Unix time]. To get the current Unix time in Lua, use <code>os.time(os.date("*t"))</code>.
  
<translate><!--T:94--> See also: </translate>
+
See also:  
[[#setdiscordelapsedstarttime|setDiscordElapsedStartTime]]
+
[[Special:MyLanguage/#setdiscordelapsedstarttime|setDiscordElapsedStartTime]]
  
{{note}} <translate><!--T:95--> To ensure privacy, the time will only be shown if the Lua API is enabled and the time is not hidden.</translate>
+
</translate>
 +
{{note}}
 +
<translate> To ensure privacy, the time will only be shown if the Lua API is enabled and the time is not hidden.
  
{{note}} <translate><!--T:96--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14
  
;<translate><!--T:97--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
-- <translate><!--T:98--> set the timer to start counting down from an hour from now</translate>
+
-- set the timer to start counting down from an hour from now
setDiscordRemainingEndTime(os.time(os.date("*t"))+(60 * 60))
+
lua setDiscordRemainingEndTime(os.time(os.date("*t"))+(60 * 60))
 
</syntaxhighlight>
 
</syntaxhighlight>
  
  
 +
</translate>
 
<span id="setdiscordsmallicon"></span>
 
<span id="setdiscordsmallicon"></span>
 +
<translate>
 
==setDiscordSmallIcon==
 
==setDiscordSmallIcon==
  
 
;setDiscordSmallIcon()
 
;setDiscordSmallIcon()
: <translate><!--T:99--> Sets the small 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.</translate>
+
: Sets the small 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.  
  
<translate><!--T:100--> 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).</translate>
+
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).
  
<translate><!--T:101--> 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|setDiscordApplicationID()]].</translate>
+
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 [[Special:MyLanguage/#setdiscordapplicationid|setDiscordApplicationID()]].
  
<translate><!--T:102--> See also: </translate>
+
See also:  
[[#getdiscordsmallicon|getDiscordSmallIcon]], [[#setdiscordsmallicontext|setDiscordSmallIconText]], [[#setdiscordapplicationid|setDiscordApplicationID]]
+
[[Special:MyLanguage/#getdiscordsmallicon|getDiscordSmallIcon]], [[Special:MyLanguage/#setdiscordsmallicontext|setDiscordSmallIconText]], [[Special:MyLanguage/#setdiscordapplicationid|setDiscordApplicationID]]
  
{{note}} <translate><!--T:103--> To ensure privacy, the icon will only be shown if the Lua API is enabled and the small icon is not hidden.</translate>
+
</translate>
 +
{{note}}
 +
<translate> To ensure privacy, the icon will only be shown if the Lua API is enabled and the small icon is not hidden.  
  
{{note}} <translate><!--T:104--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14.
  
;<translate><!--T:105--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
setDiscordSmallIcon("envelope")
 
setDiscordSmallIcon("envelope")
setDiscordSmallIconText("<translate><!--T:106--> Writing letters</translate>")
+
setDiscordSmallIconText("Writing letters")
setDiscordState("<translate><!--T:107--> Writing letters</translate>")
+
setDiscordState("Writing letters")
 
</syntaxhighlight>
 
</syntaxhighlight>
  
  
 +
</translate>
 
<span id="setdiscordsmallicontext"></span>
 
<span id="setdiscordsmallicontext"></span>
 +
<translate>
 
==setDiscordSmallIconText==
 
==setDiscordSmallIconText==
  
 
;setDiscordSmallIconText()
 
;setDiscordSmallIconText()
: <translate><!--T:108--> Sets the tooltip for the small 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 small icon is shown.</translate>
+
: Sets the tooltip for the small 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 small icon is shown.  
  
<translate><!--T:109--> See also: </translate>
+
See also:  
[[#setdiscordsmallicon|setDiscordSmallIcon]]
+
[[Special:MyLanguage/#setdiscordsmallicon|setDiscordSmallIcon]]
  
{{note}} <translate><!--T:110--> To ensure privacy, the tooltip will only be shown if the Lua API is enabled, and small icon with the small icon tooltip is set to show.</translate>
+
</translate>
 +
{{note}}
 +
<translate> To ensure privacy, the tooltip will only be shown if the Lua API is enabled, and small icon with the small icon tooltip is set to show.  
  
{{note}} <translate><!--T:111--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14.
  
;<translate><!--T:112--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
setDiscordSmallIcon("map")
 
setDiscordSmallIcon("map")
setDiscordSmallIconText("<translate><!--T:113--> Exploring</translate>")
+
setDiscordSmallIconText("Exploring")
 
</syntaxhighlight>
 
</syntaxhighlight>
  
  
 +
</translate>
 
<span id="setdiscordstate"></span>
 
<span id="setdiscordstate"></span>
 +
<translate>
 
==setDiscordState==
 
==setDiscordState==
  
 
;setDiscordState(state)
 
;setDiscordState(state)
: <translate><!--T:114--> Sets the text to be shown in the state field of 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 on where the state is shown.</translate>
+
: Sets the text to be shown in the state field of 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 on where the state is shown.
  
<translate><!--T:115--> See also: </translate>
+
See also:  
[[#getdiscordstate|getDiscordState]], [[#setdiscorddetail|setDiscordDetail]]
+
[[Special:MyLanguage/#getdiscordstate|getDiscordState]], [[Special:MyLanguage/#setdiscorddetail|setDiscordDetail]]
  
{{note}} <translate><!--T:116--> To ensure privacy, the state will only be shown if the Lua API is enabled and the state is not hidden.</translate>
+
</translate>
 +
{{note}}
 +
<translate> To ensure privacy, the state will only be shown if the Lua API is enabled and the state is not hidden.
  
{{note}} <translate> <!--T:117--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14
  
;<translate><!--T:118--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
-- <translate><!--T:119--> set state to your current area</translate>
+
-- set state to your current area
 
local currentarea = getRoomArea(getPlayerRoom())
 
local currentarea = getRoomArea(getPlayerRoom())
 
local areaname = getAreaTableSwap()[currentarea]
 
local areaname = getAreaTableSwap()[currentarea]
Line 379: Line 467:
  
  
 +
</translate>
 
<span id="usingmudletsdiscordid"></span>
 
<span id="usingmudletsdiscordid"></span>
 +
<translate>
 +
 
==usingMudletsDiscordID==
 
==usingMudletsDiscordID==
  
 
;usingMudletsDiscordID()
 
;usingMudletsDiscordID()
: <translate><!--T:120--> Returns true if the currently playing game is set to "Mudlet". You can change this with [[#setdiscordapplicationid|setDiscordApplicationID()]].</translate>
+
: Returns true if the currently playing game is set to "Mudlet". You can change this with [[Special:MyLanguage/#setdiscordapplicationid|setDiscordApplicationID()]].
  
<translate><!--T:121--> See also: </translate>
+
See also:  
[[#setdiscordapplicationid|setDiscordApplicationID]]
+
[[Special:MyLanguage/#setdiscordapplicationid|setDiscordApplicationID]]
  
{{note}} <translate><!--T:122--> Available since Mudlet 3.14.</translate>
+
</translate>
 +
{{note}}
 +
<translate> Available since Mudlet 3.14
  
;<translate><!--T:123--> Example</translate>
+
;Example
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
if usingMudletsDiscordID() then
 
if usingMudletsDiscordID() then
   print('<translate><!--T:124--> It is showing "Playing Mudlet" right now!</translate>')
+
   print('It is showing "Playing Mudlet" right now!')
 
end
 
end
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
</translate>

Revision as of 05:47, 1 July 2020

Other languages:
Deutsch • ‎English • ‎Nederlands • ‎Türkçe • ‎français • ‎italiano • ‎polski • ‎suomi • ‎Ελληνικά • ‎русский • ‎العربية • ‎한국어

For an overview on how all of these functions tie in together, see our Discord scripting overview.


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(id)
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.

Parameters
  • id: (required) id as a string.
Mudlet Discord ApplicationID.png

See also: setDiscordGame, usingMudletsDiscordID

Note Note:

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

Note Note:

So you do not have to remember that long number you can also reset to the default Mudlet ID by calling this function without an argument:
setDiscordApplicationID()


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 detail is shown. Note that this will overwrite the same information set by setDiscordGame().

See also: getDiscordDetail, setDiscordGame

Note Note:

To ensure privacy, the detail will only be shown if the Lua API is enabled and the detail is not hidden.

Note Note:

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


setDiscordElapsedStartTime

setDiscordElapsedStartTime(time)
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.
Parameters
  • time: (required) time as a Unix time. To get the current Unix time in Lua, use os.time(os.date("*t")).

See also: setDiscordRemainingEndTime

Note Note:

To ensure privacy, the time will only be shown if the Lua API is enabled and the time is not hidden.

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:

To ensure privacy, the game and icon will only be shown if the Lua API is enabled, and detail and large icon are set to show.

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")
setDiscordLargeIconText("Fishing")
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 large icon with the large icon tooltip is set to show. 

Note Note:

Available since Mudlet 3.14.
Example
setDiscordLargeIcon("axe")
setDiscordLargeIconText("Killing heterics")


setDiscordParty

setDiscordParty(current, max)
Sets the party information the Discord Rich Presence. See Discord docs for a handy image reference the party is shown.
Parameters
  • current: (required) current party amount.
  • max: (optional) max party amount - if not provided, then the max is set to the current amount.

See also: getDiscordParty

Note Note:

To ensure privacy, the party will only be shown if the Lua API is enabled and the party information is not hidden. 

Note Note:

Available since Mudlet 3.14.
Example
-- show that 5 out of 10 people are in currently in the party
setDiscordParty(5, 10)


setDiscordRemainingEndTime

setDiscordRemainingEndTime(time)
Sets the time to be shown for "## remaining" field in Discord Rich Presence. See Discord docs for a handy image reference on where the remaining time is shown.
Parameters
  • time: (required) time as a Unix time. To get the current Unix time in Lua, use os.time(os.date("*t")).

See also: setDiscordElapsedStartTime

Note Note:

To ensure privacy, the time will only be shown if the Lua API is enabled and the time is not hidden.

Note Note:

Available since Mudlet 3.14
Example
-- set the timer to start counting down from an hour from now
lua setDiscordRemainingEndTime(os.time(os.date("*t"))+(60 * 60))


setDiscordSmallIcon

setDiscordSmallIcon()
Sets the small 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: getDiscordSmallIcon, setDiscordSmallIconText, setDiscordApplicationID

Note Note:

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

Note Note:

Available since Mudlet 3.14.
Example
setDiscordSmallIcon("envelope")
setDiscordSmallIconText("Writing letters")
setDiscordState("Writing letters")


setDiscordSmallIconText

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

See also: setDiscordSmallIcon

Note Note:

To ensure privacy, the tooltip will only be shown if the Lua API is enabled, and small icon with the small icon tooltip is set to show. 

Note Note:

Available since Mudlet 3.14.
Example
setDiscordSmallIcon("map")
setDiscordSmallIconText("Exploring")


setDiscordState

setDiscordState(state)
Sets the text to be shown in the state field of Discord Rich Presence. See Discord docs for a handy image reference on where the state is shown.

See also: getDiscordState, setDiscordDetail

Note Note:

To ensure privacy, the state will only be shown if the Lua API is enabled and the state is not hidden.

Note Note:

Available since Mudlet 3.14
Example
-- set state to your current area
local currentarea = getRoomArea(getPlayerRoom())
local areaname = getAreaTableSwap()[currentarea]
setDiscordDetail(areaname)


usingMudletsDiscordID

usingMudletsDiscordID()
Returns true if the currently playing game is set to "Mudlet". You can change this with setDiscordApplicationID().

See also: setDiscordApplicationID

Note Note:

Available since Mudlet 3.14
Example
if usingMudletsDiscordID() then
  print('It is showing "Playing Mudlet" right now!')
end