Skip to content

!so with a custom message format posts an empty message #722

Open

Description

@emircan-sahin

Describe the bug
With a custom shoutout format, !so posts an empty message. FormatContent is called with msg, which is still "", instead of messageFormat:

twitchURL := "https://www.twitch.tv/" + livestreamerData.UserLogin
var msg string
if messageFormat != "" {
msg = helper.FormatContent(msg, model.TwitchStreamerData{
UserName: livestreamerData.UserName,
UserLogin: livestreamerData.UserLogin,
GameName: livestreamerData.GameName,
})

The default format (no custom one) works.

To Reproduce
Call GiveShoutout with a non-empty message format: it returns "".

Expected behavior
helper.FormatContent(messageFormat, ...).

Additional context

  • The placeholders documented in the TODO at
    // TODO: Add this to web interface so streamers can customize their shoutout message format. The messageFormat can include placeholders like {streamer} {url} {game} which will be replaced with the actual streamer name, stream URL, and current game respectively.
    ({streamer} {url} {game}) aren't the ones FormatContent replaces ({twitch.username}, {twitch.url}, {stream.game}).
  • go test ./twitchapi has 3 failing tests: TestGiveShoutout_DefaultMessage, TestGiveShoutout_CustomMessageFormat and TestGiveShoutout_UserNotFound (the last one panics at twitchapi_test.go:303). They still mock the /users endpoint that refactor: update logic in twitchapi GiveShoutout #636 stopped using.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions