Difference between revisions of "Manual:Discord Functions"

From Mudlet
Jump to navigation Jump to search
(Marked this version for translation)
m (→‎Discord Functions: update to mudlet version template)
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
+
<languages />
 
{{TOC right}}
 
{{TOC right}}
<translate><!--T:125--> 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>
+
{{#description2:Mudlet API documentation for functions to customize the information Mudlet displays in Discord's rich presence interface.}}
 +
=Discord Functions=
  
 +
<translate><!--T:125--> All functions to customize the information Mudlet displays in Discord's rich presence interface. 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>
 +
 
==getDiscordDetail==
 
==getDiscordDetail==
  
Line 13: Line 16:
 
[[#setdiscorddetail|setDiscordDetail]]
 
[[#setdiscorddetail|setDiscordDetail]]
  
{{note}} <translate><!--T:128--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:129--> Example</translate>
 
;<translate><!--T:129--> Example</translate>
Line 22: Line 25:
  
 
<span id="getdiscordlargeicon"></span>
 
<span id="getdiscordlargeicon"></span>
 +
 
==getDiscordLargeIcon==
 
==getDiscordLargeIcon==
  
Line 30: Line 34:
 
[[#setdiscordlargeicon|setDiscordLargeIcon]]
 
[[#setdiscordlargeicon|setDiscordLargeIcon]]
  
{{note}} <translate><!--T:133--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:134--> Example</translate>
 
;<translate><!--T:134--> Example</translate>
Line 47: Line 51:
 
[[#setdiscordlargeicontext|setDiscordLargeIconText]]
 
[[#setdiscordlargeicontext|setDiscordLargeIconText]]
  
{{note}} <translate><!--T:138--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:139--> Example</translate>
 
;<translate><!--T:139--> Example</translate>
Line 64: Line 68:
 
[[#setdiscordparty|setDiscordParty]]
 
[[#setdiscordparty|setDiscordParty]]
  
{{note}} <translate><!--T:143--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:144--> Example</translate>
 
;<translate><!--T:144--> Example</translate>
Line 83: Line 87:
 
[[#setdiscordsmallicon|setDiscordSmallIcon]]
 
[[#setdiscordsmallicon|setDiscordSmallIcon]]
  
{{note}} <translate><!--T:148--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:149--> Example</translate>
 
;<translate><!--T:149--> Example</translate>
Line 99: Line 103:
 
[[#setdiscordsmallicontext|setDiscordSmallIconText]]
 
[[#setdiscordsmallicontext|setDiscordSmallIconText]]
  
{{note}} <translate><!--T:153--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:154--> Example</translate>
 
;<translate><!--T:154--> Example</translate>
Line 116: Line 120:
 
[[#setdiscordstate|setDiscordState]]
 
[[#setdiscordstate|setDiscordState]]
  
{{note}} <translate><!--T:158--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:159--> Example</translate>
 
;<translate><!--T:159--> Example</translate>
Line 125: Line 129:
  
 
<span id="setdiscordapplicationid"></span>
 
<span id="setdiscordapplicationid"></span>
 +
 +
==getDiscordTimeStamps==
 +
 +
;getDiscordTimeStamps()
 +
: <translate>Returns the start/end Discord timestamps as set by [[#setDiscordElapsedStartTime|setDiscordElapsedStartTime()]] and [[#setDiscordRemainingEndTime|setDiscordRemainingEndTime()]].</translate>
 +
 +
<translate><!--T:157--> See also: </translate>
 +
[[#setDiscordElapsedStartTime|setDiscordElapsedStartTime]], [[#setDiscordRemainingEndTime|setDiscordRemainingEndTime]]
 +
 +
{{MudletVersion|3.14}}
 +
 +
;<translate><!--T:159--> Example</translate>
 +
<syntaxhighlight lang="lua">
 +
display(getDiscordTimeStamps())
 +
</syntaxhighlight>
 +
 
==setDiscordApplicationID==
 
==setDiscordApplicationID==
  
 
;setDiscordApplicationID(id)
 
;setDiscordApplicationID(id)
: <translate><!--T:161--> 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>
+
: <translate><!--T:161--> 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. This will currently (as of Mudlet 4.9.1) bypass the Discord privacy option "Enable Lua API" on future sessions if a non-empty id is specified. Returns true if the Discord application ID is in the correct format.</translate>
  
 
<translate><!--T:162--> 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>
 
<translate><!--T:162--> 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>
  
<translate><!--T:163--> Mudlet calls the client ID an application ID to avoid confusion with the Mudlet internal Discord client ID.</translate>
+
<translate><!--T:163--> Mudlet calls this the Application ID to avoid confusion with Mudlet being a game client - however Discord uses both Application ID and Client ID to refer to this detail (which seems to be an 18 digit number).</translate>
  
 
;<translate><!--T:164--> Parameters </translate>
 
;<translate><!--T:164--> Parameters </translate>
Line 142: Line 162:
 
[[#setdiscordgame|setDiscordGame]], [[#usingmudletsdiscordid|usingMudletsDiscordID]]
 
[[#setdiscordgame|setDiscordGame]], [[#usingmudletsdiscordid|usingMudletsDiscordID]]
  
{{note}} <translate><!--T:167--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:168--> Example</translate>
 
;<translate><!--T:168--> Example</translate>
Line 157: Line 177:
  
 
<span id="setdiscorddetail"></span>
 
<span id="setdiscorddetail"></span>
 +
 
==setDiscordDetail==
 
==setDiscordDetail==
  
;setDiscordDetail()
+
;setDiscordDetail(text)
 
: <translate><!--T:171--> 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>
 
: <translate><!--T:171--> 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>
  
Line 167: Line 188:
 
{{note}} <translate><!--T:173--> To ensure privacy, the detail will only be shown if the Lua API is enabled and the detail is not hidden.</translate>
 
{{note}} <translate><!--T:173--> To ensure privacy, the detail will only be shown if the Lua API is enabled and the detail is not hidden.</translate>
  
{{note}} <translate><!--T:174--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:175--> Example</translate>
 
;<translate><!--T:175--> Example</translate>
Line 190: Line 211:
 
{{note}} <translate><!--T:181--> To ensure privacy, the time will only be shown if the Lua API is enabled and the time is not hidden.</translate>
 
{{note}} <translate><!--T:181--> To ensure privacy, the time will only be shown if the Lua API is enabled and the time is not hidden.</translate>
  
{{note}} <translate><!--T:182--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:183--> Example</translate>
 
;<translate><!--T:183--> Example</translate>
Line 202: Line 223:
 
==setDiscordGame==
 
==setDiscordGame==
  
;setDiscordGame()
+
;setDiscordGame(text)
 
: <translate><!--T:185--> 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>
 
: <translate><!--T:185--> 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>
  
Line 212: Line 233:
 
{{note}} <translate><!--T:188--> 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>
 
{{note}} <translate><!--T:188--> 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>
  
{{note}} <translate><!--T:189--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:190--> Example</translate>
 
;<translate><!--T:190--> Example</translate>
Line 223: Line 244:
 
==setDiscordLargeIcon==
 
==setDiscordLargeIcon==
  
;setDiscordLargeIcon()
+
;setDiscordLargeIcon(iconName)
 
: <translate><!--T:191--> 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>
 
: <translate><!--T:191--> 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>
  
Line 235: Line 256:
 
{{note}} <translate><!--T:195--> To ensure privacy, the icon will only be shown if the Lua API is enabled and the large icon is not hidden.</translate>
 
{{note}} <translate><!--T:195--> To ensure privacy, the icon will only be shown if the Lua API is enabled and the large icon is not hidden.</translate>
  
{{note}} <translate><!--T:196--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:197--> Example</translate>
 
;<translate><!--T:197--> Example</translate>
Line 248: Line 269:
 
==setDiscordLargeIconText==
 
==setDiscordLargeIconText==
  
;setDiscordLargeIconText()
+
;setDiscordLargeIconText(text)
 
: <translate><!--T:200--> 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>
 
: <translate><!--T:200--> 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>
  
Line 256: Line 277:
 
{{note}} <translate><!--T:202--> 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>
 
{{note}} <translate><!--T:202--> 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>
  
{{note}} <translate><!--T:203--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:204--> Example</translate>
 
;<translate><!--T:204--> Example</translate>
Line 280: Line 301:
 
{{note}} <translate><!--T:211--> To ensure privacy, the party will only be shown if the Lua API is enabled and the party information is not hidden.</translate>
 
{{note}} <translate><!--T:211--> To ensure privacy, the party will only be shown if the Lua API is enabled and the party information is not hidden.</translate>
  
{{note}} <translate><!--T:212--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:213--> Example</translate>
 
;<translate><!--T:213--> Example</translate>
Line 303: Line 324:
 
{{note}} <translate><!--T:219--> To ensure privacy, the time will only be shown if the Lua API is enabled and the time is not hidden.</translate>
 
{{note}} <translate><!--T:219--> To ensure privacy, the time will only be shown if the Lua API is enabled and the time is not hidden.</translate>
  
{{note}} <translate><!--T:220--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:221--> Example</translate>
 
;<translate><!--T:221--> Example</translate>
Line 315: Line 336:
 
==setDiscordSmallIcon==
 
==setDiscordSmallIcon==
  
;setDiscordSmallIcon()
+
;setDiscordSmallIcon(iconName)
 
: <translate><!--T:223--> 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>
 
: <translate><!--T:223--> 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>
  
Line 327: Line 348:
 
{{note}} <translate><!--T:227--> To ensure privacy, the icon will only be shown if the Lua API is enabled and the small icon is not hidden.</translate>
 
{{note}} <translate><!--T:227--> To ensure privacy, the icon will only be shown if the Lua API is enabled and the small icon is not hidden.</translate>
  
{{note}} <translate><!--T:228--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:229--> Example</translate>
 
;<translate><!--T:229--> Example</translate>
Line 340: Line 361:
 
==setDiscordSmallIconText==
 
==setDiscordSmallIconText==
  
;setDiscordSmallIconText()
+
;setDiscordSmallIconText(text)
 
: <translate><!--T:232--> 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>
 
: <translate><!--T:232--> 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>
  
Line 348: Line 369:
 
{{note}} <translate><!--T:234--> 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>
 
{{note}} <translate><!--T:234--> 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>
  
{{note}} <translate><!--T:235--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:236--> Example</translate>
 
;<translate><!--T:236--> Example</translate>
Line 368: Line 389:
 
{{note}} <translate><!--T:240--> To ensure privacy, the state will only be shown if the Lua API is enabled and the state is not hidden.</translate>
 
{{note}} <translate><!--T:240--> To ensure privacy, the state will only be shown if the Lua API is enabled and the state is not hidden.</translate>
  
{{note}} <translate> <!--T:241--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:242--> Example</translate>
 
;<translate><!--T:242--> Example</translate>
Line 388: Line 409:
 
[[#setdiscordapplicationid|setDiscordApplicationID]]
 
[[#setdiscordapplicationid|setDiscordApplicationID]]
  
{{note}} <translate><!--T:246--> Available since Mudlet 3.14.</translate>
+
{{MudletVersion|3.14}}
  
 
;<translate><!--T:247--> Example</translate>
 
;<translate><!--T:247--> Example</translate>

Revision as of 11:23, 11 June 2021

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

Discord Functions

All functions to customize the information Mudlet displays in Discord's rich presence interface. 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

Mudlet VersionAvailable in Mudlet3.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

Mudlet VersionAvailable in Mudlet3.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

Mudlet VersionAvailable in Mudlet3.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

Mudlet VersionAvailable in Mudlet3.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

Mudlet VersionAvailable in Mudlet3.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

Mudlet VersionAvailable in Mudlet3.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

Mudlet VersionAvailable in Mudlet3.14+
Example
print("Discord state is: ".. getDiscordState())


getDiscordTimeStamps

getDiscordTimeStamps()
Returns the start/end Discord timestamps as set by setDiscordElapsedStartTime() and setDiscordRemainingEndTime().

See also: setDiscordElapsedStartTime, setDiscordRemainingEndTime

Mudlet VersionAvailable in Mudlet3.14+
Example
display(getDiscordTimeStamps())

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. This will currently (as of Mudlet 4.9.1) bypass the Discord privacy option "Enable Lua API" on future sessions if a non-empty id is specified. 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 this the Application ID to avoid confusion with Mudlet being a game client - however Discord uses both Application ID and Client ID to refer to this detail (which seems to be an 18 digit number).

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

See also: setDiscordGame, usingMudletsDiscordID

Mudlet VersionAvailable in Mudlet3.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(text)
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.

Mudlet VersionAvailable in Mudlet3.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.

Mudlet VersionAvailable in Mudlet3.14+
Example
-- set the timer to start counting up from now:
setDiscordElapsedStartTime(os.time(os.date("*t")))


setDiscordGame

setDiscordGame(text)
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.

Mudlet VersionAvailable in Mudlet3.14+
Example
setDiscordGame("WoTMUD")


setDiscordLargeIcon

setDiscordLargeIcon(iconName)
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.

Mudlet VersionAvailable in Mudlet3.14+
Example
setDiscordLargeIcon("coin")
setDiscordLargeIconText("Fishing")
setDiscordState("Fishing")


setDiscordLargeIconText

setDiscordLargeIconText(text)
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.

Mudlet VersionAvailable in Mudlet3.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.

Mudlet VersionAvailable in Mudlet3.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.

Mudlet VersionAvailable in Mudlet3.14+
Example
-- set the timer to start counting down from an hour from now
setDiscordRemainingEndTime(os.time(os.date("*t"))+(60 * 60))


setDiscordSmallIcon

setDiscordSmallIcon(iconName)
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.

Mudlet VersionAvailable in Mudlet3.14+
Example
setDiscordSmallIcon("envelope")
setDiscordSmallIconText("Writing letters")
setDiscordState("Writing letters")


setDiscordSmallIconText

setDiscordSmallIconText(text)
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.

Mudlet VersionAvailable in Mudlet3.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.

Mudlet VersionAvailable in Mudlet3.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

Mudlet VersionAvailable in Mudlet3.14+
Example
if usingMudletsDiscordID() then
  print('It is showing "Playing Mudlet" right now!')
end