Skip to content

Commit

Permalink
fix(trend): fix helper commands bugs (#25)
Browse files Browse the repository at this point in the history
replaced EmbedField to plaintext
  • Loading branch information
TropicalDog17 authored Nov 20, 2023
1 parent 6f98f0f commit 976ef51
Showing 1 changed file with 9 additions and 25 deletions.
34 changes: 9 additions & 25 deletions pkg/discord/view/trend/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,53 +76,37 @@ func (e *Trend) List(message *model.DiscordMessage, repos []*model.Repo) error {

func (e *Trend) ListDateRange(message *model.DiscordMessage) error {
title := "### :chart_with_upwards_trend: Github Trending Repositories\n"
var messageEmbed []*discordgo.MessageEmbedField
content := ""
for k := range dateRangeStarGainedMap {
embedField := &discordgo.MessageEmbedField{
Name: k,
}
messageEmbed = append(messageEmbed, embedField)
content += k + "\n"
}
msg := &discordgo.MessageEmbed{
Description: title + "Available value for <date_range> parameter",

Fields: messageEmbed,
Description: title + "Available value for <date_range> parameter\n" + content,
}

return base.SendEmbededMessage(e.ses, message, msg)
}

func (e *Trend) ListProgramLang(message *model.DiscordMessage) error {
title := "### :chart_with_upwards_trend: Github Trending Repositories\n"

var messageEmbed []*discordgo.MessageEmbedField
content := ""
for _, v := range programmingLanguages {
embedField := &discordgo.MessageEmbedField{
Name: v,
}
messageEmbed = append(messageEmbed, embedField)
content += v + "\n"
}
msg := &discordgo.MessageEmbed{
Description: title + "Available value for <lang> parameter",
Fields: messageEmbed,
Description: title + "Available value for <lang> parameter\n" + content,
}

return base.SendEmbededMessage(e.ses, message, msg)
}

func (e *Trend) ListSpokenLang(message *model.DiscordMessage) error {
title := "### :chart_with_upwards_trend: Github Trending Repositories\n"

var messageEmbed []*discordgo.MessageEmbedField
content := ""
for k := range spokenLangMap {
embedField := &discordgo.MessageEmbedField{
Name: k,
}
messageEmbed = append(messageEmbed, embedField)
content += k + "\n"
}
msg := &discordgo.MessageEmbed{
Description: title + "Available value for <spoken_lang> parameter",
Fields: messageEmbed,
Description: title + "Available value for <spoken_lang> parameter\n" + content,
}

return base.SendEmbededMessage(e.ses, message, msg)
Expand Down

0 comments on commit 976ef51

Please sign in to comment.