Skip to content

Commit

Permalink
fix: update msg layout of event help and memo cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
baenv committed Jul 5, 2024
1 parent bacfa6c commit dbf6305
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 3 additions & 4 deletions pkg/discord/view/event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ func New(ses *discordgo.Session) EventViewer {

func (e *Event) Help(message *model.DiscordMessage) error {
content := []string{
`**?event list**・get events from notion
**?event scheduled list/ls**・get discord scheduled events
**?event scheduled set/s speaker/spk <discord_event_id> @user1:topic1 @user2:topic2**・set speakers for scheduled events
`**?event list/ls**・get discord scheduled events
**?event speakerset spks <eventID> <topic1> @user1 @user2 <topic2> @user3**・set speakers for scheduled events
`,
"*Example:* `?event scheduled s spk 123871623 @nam:topic1 @nam2:topic2 @nam3:topic3`",
"*Example:* `?event spks 1256184313876054147 Erlang @bienvh AI-101 @cherry`",
}

msg := &discordgo.MessageEmbed{
Expand Down
8 changes: 6 additions & 2 deletions pkg/discord/view/memo/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ import (
)

var (
memoCategoryList = []string{memoCategoryFleeting, memoCategoryLiterature, memoCategoryOthers}
memoCategoryList = []string{memoCategoryFleeting, memoCategoryLiterature, memoCategoryEarn, memoCategoryOthers}
)

const (
memoCategoryFleeting = "00_fleeting"
memoCategoryLiterature = "01_literature"
memoCategoryEarn = "earn"
memoCategoryOthers = "others"
)

Expand All @@ -43,13 +44,16 @@ func (v *Memo) ListMemoLogs(original *model.DiscordMessage, memos []model.MemoLo
memosByCategory := map[string][]model.MemoLog{
memoCategoryFleeting: make([]model.MemoLog, 0),
memoCategoryLiterature: make([]model.MemoLog, 0),
memoCategoryEarn: make([]model.MemoLog, 0),
memoCategoryOthers: make([]model.MemoLog, 0),
}

for _, mem := range memos {
isMapped := false
for _, category := range mem.Category {
if strings.EqualFold(category, memoCategoryFleeting) || strings.EqualFold(category, memoCategoryLiterature) {
if strings.EqualFold(category, memoCategoryFleeting) ||
strings.EqualFold(category, memoCategoryLiterature) ||
strings.EqualFold(category, memoCategoryEarn) {
memosByCategory[category] = append(memosByCategory[category], mem)
isMapped = true
break
Expand Down

0 comments on commit dbf6305

Please sign in to comment.