Skip to content

API SongLinks

LenweSaralonde edited this page Dec 3, 2025 · 5 revisions

Song links module

Functions

Musician.SongLinks:SendCommMessage

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.

Musician.SongLinks:SendIndexedCommMessage

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.

Musician.SongLinks:RegisterBNetComm

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"

Musician.SongLinks:RegisterIndexedComm

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

Musician.SongLinks:RegisterIndexedBNetComm

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"

Musician.SongLinks.Init

Initialize song links

Musician.SongLinks.Init()

Musician.SongLinks.NormalizeTitleForLinks

Normalize song title for links

normalizedTitle = Musician.SongLinks.NormalizeTitleForLinks(title)

Arguments

  • title (string)

Returns

  • normalizedTitle (string)

Musician.SongLinks.GetHyperlink

Format song hyperlink

link = Musician.SongLinks.GetHyperlink(title, playerName)

Arguments

  • title (string)
  • playerName (string) (optional)

Returns

  • link (string)

Musician.SongLinks.GetChatLink

Format song link for chat

link = Musician.SongLinks.GetChatLink(title, playerName)

Arguments

  • title (string)
  • playerName (string) (optional)

Returns

  • link (string)

Musician.SongLinks.HyperlinksToChatLinks

Convert hyperlinks into text links for sending in the chat

msg = Musician.SongLinks.HyperlinksToChatLinks(text)

Arguments

  • text (string)

Returns

  • msg (string)

Musician.SongLinks.ChatLinksToHyperlinks

Convert chat text links into hyperlinks

text = Musician.SongLinks.ChatLinksToHyperlinks(msg, playerName)

Arguments

  • msg (string)
  • playerName (string) (optional)

Returns

  • text (string)

Musician.SongLinks.ChatLinksToChatBubble

Convert chat links for chat bubbles

text = Musician.SongLinks.ChatLinksToChatBubble(msg)

Arguments

  • msg (string)

Returns

  • text (string)

Musician.SongLinks.OnChatBubbleMsg

OnChatBubbleMsg

Replace chat links in chat bubbles

Musician.SongLinks.OnChatBubbleMsg()

Musician.SongLinks.AddSong

Export and add song for sharing

Musician.SongLinks.AddSong(song, title, onComplete)

Arguments

  • song (Musician.Song)
  • title (string) (optional)
  • onComplete (function) (optional)

Musician.SongLinks.AddSongData

Add song data for sharing

Musician.SongLinks.AddSongData(songData, title)

Arguments

  • songData (string)
  • title (string)

Musician.SongLinks.GetRequestingSong

Returns requestedSong data for the player

requestedSong = Musician.SongLinks.GetRequestingSong(playerName)

Arguments

  • playerName (string)

Returns

  • requestedSong (table)

Musician.SongLinks.RequestSong

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)

Musician.SongLinks.RemoveRequest

Remove a song download request

Musician.SongLinks.RemoveRequest(playerName)

Arguments

  • playerName (string)

Musician.SongLinks.CancelRequest

Cancel a song download request

Musician.SongLinks.CancelRequest(playerName)

Arguments

  • playerName (string)

Musician.SongLinks.OnRequestSong

OnRequestSong

Musician.SongLinks.OnRequestSong()

Musician.SongLinks.OnSongError

OnSongError

Musician.SongLinks.OnSongError()

Musician.SongLinks.SendSong

Send song to another player by title

Musician.SongLinks.SendSong(title, playerName)

Arguments

  • title (string)
  • playerName (string)

Musician.SongLinks.SendSongData

Send song data to another player

Musician.SongLinks.SendSongData(title, playerName, songData)

Arguments

  • title (string)
  • playerName (string)
  • songData (string)

Musician.SongLinks.OnSongData

OnSongData

Notify download progression

Musician.SongLinks.OnSongData()

Musician.SongLinks.OnSongImportProgress

OnSongImportProgress

Notify import progression

Musician.SongLinks.OnSongImportProgress()

Musician.SongLinks.OnSongReceived

OnSongReceived

Song data has been received

Musician.SongLinks.OnSongReceived()

Musician.SongLinks.PreventChatCloseOnFocus

Prevent the chat edit box from closing when the button is clicked.

Musician.SongLinks.PreventChatCloseOnFocus(button)

Arguments

  • button (Button)

Clone this wiki locally