ryanwinchester / tmi.ex

Twitch Messaging Interface for Elixir.
Apache License 2.0
44 stars 7 forks source link

There should be some documentation on how to use tags #12

Open treuks opened 2 years ago

treuks commented 2 years ago

I tried to figure out how to get the display-nametag to use in a command, and there was not a single line of documentation on how to access the tags.

I gave the bot the ["tags", "membership", "commands"] capabilities, and attempted to get the display-name tag like so

  def handle_message("k!" <> command, sender, chat, tags) do
    case command do

      "test123" ->
        say(chat, "#{tags["display-name"]}, test123")

      _ ->
        say(chat, "unrecognized command")
    end
  end

However, it did not work. I tried putting the tags from the handle message into a debug line, and it did not give me any. At this point, I'm not sure if I'm in the wrong here, or the library.

Please send help, thank you.

ryanwinchester commented 2 years ago

Tags look like:

%{
  "@badge-info" => "subscriber/25",
  "badges" => "broadcaster/1,subscriber/0",
  "color" => "#333333",
  "display-name" => "JohnDoe"
}

There are no docs for it yet because I want to change them a bit. Like additional parsing of badges, etc.