-
-
Notifications
You must be signed in to change notification settings - Fork 7
API SongLinks
Song links module
-
Functions
- Musician.SongLinks:SendCommMessage
- Musician.SongLinks:SendIndexedCommMessage
- Musician.SongLinks:RegisterBNetComm
- Musician.SongLinks:RegisterIndexedComm
- Musician.SongLinks:RegisterIndexedBNetComm
- Musician.SongLinks.Init
- Musician.SongLinks.NormalizeTitleForLinks
- Musician.SongLinks.GetHyperlink
- Musician.SongLinks.GetChatLink
- Musician.SongLinks.HyperlinksToChatLinks
- Musician.SongLinks.ChatLinksToHyperlinks
- Musician.SongLinks.ChatLinksToChatBubble
- Musician.SongLinks.OnChatBubbleMsg
- Musician.SongLinks.AddSong
- Musician.SongLinks.AddSongData
- Musician.SongLinks.GetRequestingSong
- Musician.SongLinks.RequestSong
- Musician.SongLinks.RemoveRequest
- Musician.SongLinks.CancelRequest
- Musician.SongLinks.OnRequestSong
- Musician.SongLinks.OnSongError
- Musician.SongLinks.SendSong
- Musician.SongLinks.SendSongData
- Musician.SongLinks.OnSongData
- Musician.SongLinks.OnSongImportProgress
- Musician.SongLinks.OnSongReceived
- Musician.SongLinks.PreventChatCloseOnFocus
Simplified version of AceComm's SendCommMessage that only supports short (not multipart) communication messages but supports Battle.net.
Musician.SongLinks:SendCommMessage(prefix, text, distribution, target, [prio], [callbackFn], [callbackArg])Arguments
- prefix (string) A printable character (\032-\255) classification of the message (typically AddonName or AddonNameEvent)
- text (string) Data to send, nils (\000) not allowed. Any length.
- distribution (string) Addon channel, e.g. "RAID", "GUILD", etc; see SendAddonMessage API
- target (string) Destination for some distributions; see SendAddonMessage API or valid Battle.net game account ID
- [prio] (string) OPTIONAL: ChatThrottleLib priority, "BULK", "NORMAL" or "ALERT". Defaults to "NORMAL".
- [callbackFn] (function) OPTIONAL: callback function to be called as each chunk is sent. receives 3 args: the user supplied arg (see next), the number of bytes sent so far, and the number of bytes total to send.
- [callbackArg] (any) : OPTIONAL: first arg to the callback function. nil will be passed if not specified.
Alternative to AceComm's SendCommMessage() to support Battle.net and avoid problems when the chunks are received in the wrong order.
Musician.SongLinks:SendIndexedCommMessage(prefix, text, distribution, target, [prio], [callbackFn], [callbackArg])Arguments
- prefix (string) A printable character (\032-\255) classification of the message (typically AddonName or AddonNameEvent)
- text (string) Data to send, nils (\000) not allowed. Any length.
- distribution (string) Addon channel, e.g. "RAID", "GUILD", etc; see SendAddonMessage API
- target (string) Destination for some distributions; see SendAddonMessage API or valid Battle.net game account ID
- [prio] (string) OPTIONAL: ChatThrottleLib priority, "BULK", "NORMAL" or "ALERT". Defaults to "NORMAL".
- [callbackFn] (function) OPTIONAL: callback function to be called as each chunk is sent. receives 3 args: the user supplied arg (see next), the number of bytes sent so far, and the number of bytes total to send.
- [callbackArg] (any) : OPTIONAL: first arg to the callback function. nil will be passed if not specified.
Handler for short (not multipart) Battle.net messages, similar to AceComm's RegisterComm().
Musician.SongLinks:RegisterBNetComm(prefix, method)Arguments
- prefix (string) A printable character (\032-\255) classification of the message (typically AddonName or AddonNameEvent), max 16 characters
- method (function) Callback to call on message reception: Function reference, or method name (string) to call on self. Defaults to "OnCommReceived"
Same as AceComm's RegisterComm but for multipart communication message with indexed chunks. Supports Battle.net messages.
Musician.SongLinks:RegisterIndexedComm(prefix, method, [isBnet])Arguments
- prefix (string) A printable character (\032-\255) classification of the message (typically AddonName or AddonNameEvent), max 16 characters
- method (function) Callback to call on message reception: Function reference, or method name (string) to call on self. Defaults to "OnCommReceived"
- [isBnet] (boolean) Register Battle.net messages when true
Same as RegisterIndexedComm but for Battle.net messages only.
Musician.SongLinks:RegisterIndexedBNetComm(prefix, method)Arguments
- prefix (string) A printable character (\032-\255) classification of the message (typically AddonName or AddonNameEvent), max 16 characters
- method (function) Callback to call on message reception: Function reference, or method name (string) to call on self. Defaults to "OnCommReceived"
Initialize song links
Musician.SongLinks.Init()Normalize song title for links
normalizedTitle = Musician.SongLinks.NormalizeTitleForLinks(title)Arguments
- title (string)
Returns
- normalizedTitle (string)
Format song hyperlink
link = Musician.SongLinks.GetHyperlink(title, playerName)Arguments
- title (string)
- playerName (string) (optional)
Returns
- link (string)
Format song link for chat
link = Musician.SongLinks.GetChatLink(title, playerName)Arguments
- title (string)
- playerName (string) (optional)
Returns
- link (string)
Convert hyperlinks into text links for sending in the chat
msg = Musician.SongLinks.HyperlinksToChatLinks(text)Arguments
- text (string)
Returns
- msg (string)
Convert chat text links into hyperlinks
text = Musician.SongLinks.ChatLinksToHyperlinks(msg, playerName)Arguments
- msg (string)
- playerName (string) (optional)
Returns
- text (string)
Convert chat links for chat bubbles
text = Musician.SongLinks.ChatLinksToChatBubble(msg)Arguments
- msg (string)
Returns
- text (string)
OnChatBubbleMsg
Replace chat links in chat bubbles
Musician.SongLinks.OnChatBubbleMsg()Export and add song for sharing
Musician.SongLinks.AddSong(song, title, onComplete)Arguments
- song (Musician.Song)
- title (string) (optional)
- onComplete (function) (optional)
Add song data for sharing
Musician.SongLinks.AddSongData(songData, title)Arguments
- songData (string)
- title (string)
Returns requestedSong data for the player
requestedSong = Musician.SongLinks.GetRequestingSong(playerName)Arguments
- playerName (string)
Returns
- requestedSong (table)
Request a song for download to a player
Musician.SongLinks.RequestSong(title, playerName, dataOnly, context)Arguments
- title (string)
- playerName (string)
- dataOnly (boolean) (default=false)
- context (table) Reference to the module that initiated the song request. (optional)
Remove a song download request
Musician.SongLinks.RemoveRequest(playerName)Arguments
- playerName (string)
Cancel a song download request
Musician.SongLinks.CancelRequest(playerName)Arguments
- playerName (string)
OnRequestSong
Musician.SongLinks.OnRequestSong()OnSongError
Musician.SongLinks.OnSongError()Send song to another player by title
Musician.SongLinks.SendSong(title, playerName)Arguments
- title (string)
- playerName (string)
Send song data to another player
Musician.SongLinks.SendSongData(title, playerName, songData)Arguments
- title (string)
- playerName (string)
- songData (string)
OnSongData
Notify download progression
Musician.SongLinks.OnSongData()OnSongImportProgress
Notify import progression
Musician.SongLinks.OnSongImportProgress()OnSongReceived
Song data has been received
Musician.SongLinks.OnSongReceived()Prevent the chat edit box from closing when the button is clicked.
Musician.SongLinks.PreventChatCloseOnFocus(button)Arguments
- button (Button)
Table of contents
- User guide (FR)
- Optional modules
- What the FAQ
- Tips and Tricks
- Music producer guide
- Localization
- Technical design
- API documentation
Discord / MusicianList / Patreon / Donate