-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewevent.go
564 lines (527 loc) · 19.7 KB
/
newevent.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
package main
import (
"fmt"
"log"
"time"
"github.com/bwmarrin/discordgo"
"github.com/deefstes/ClanEventsBot/database"
"github.com/deefstes/ClanEventsBot/logging"
)
type eventState int
const (
stateNew eventState = 0
stateDate eventState = 1
stateTime eventState = 2
stateTimeZone eventState = 3
stateDuration eventState = 4
stateTeamSize eventState = 5
stateDone eventState = 6
)
type developingEvent struct {
MessageID string
TriggerMessage *discordgo.MessageCreate
State eventState
Event database.ClanEvent
Committed bool
}
//gocyclo:ignore
// ShowDevelopingEvent is used to display the progress of an interactive new event
func ShowDevelopingEvent(s *discordgo.Session, m *discordgo.MessageCreate, channel string, newEvent developingEvent) {
message := ""
// Get channel
c, err := s.Channel(channel)
if err != nil {
s.ChannelMessageSend(channel, "EventsBot had trouble obtaining the channel information :no_mouth:")
return
}
// Get guild variables
gv, ok := guildVarsMap[c.GuildID]
if !ok {
s.ChannelMessageSend(channel, "EventsBot had trouble obtaining the guild information :no_mouth:")
return
}
// Get time zone
tzInfo := ""
eventLocation := defaultLocation
if newEvent.Event.TimeZone != "" {
tz, ok := gv.tzByAbbr[newEvent.Event.TimeZone]
if !ok {
s.ChannelMessageSend(channel, "EventsBot had trouble interpreting the time zone information of this event. Are we anywhere near a worm hole perhaps? :no_mouth:")
return
}
tzInfo = tz.Abbrev
eventLocation, _ = time.LoadLocation(tz.Location)
} else {
if len(gv.timezones) == 1 {
tz := gv.timezones[0]
tzInfo = tz.Abbrev
newEvent.Event.TimeZone = tz.Abbrev
eventLocation, _ = time.LoadLocation(tz.Location)
}
}
// Construct message
message = "NEW EVENT"
message = fmt.Sprintf("%s\r\n**Creator:** %s", message, newEvent.Event.Creator.Mention())
message = fmt.Sprintf("%s\r\n**Name:** %s", message, newEvent.Event.Name)
if newEvent.State >= stateNew {
message = fmt.Sprintf("%s\r\n**Date:** %s", message, newEvent.Event.DateTime.In(eventLocation).Format("Mon 2 Jan 2006"))
}
if newEvent.State >= stateTime {
message = fmt.Sprintf("%s\r\n**Time:** %s", message, newEvent.Event.DateTime.In(eventLocation).Format("15:04"))
}
if newEvent.State > stateTimeZone { // note that this is >, not >= as we want to display the time zone only after it has been selected
if newEvent.Event.TimeZone != "" {
message = fmt.Sprintf("%s (%s)", message, tzInfo)
}
}
if newEvent.State >= stateDuration {
message = fmt.Sprintf("%s\r\n**Duration:** %d", message, newEvent.Event.Duration)
}
if newEvent.State >= stateTeamSize {
message = fmt.Sprintf("%s\r\n**Team Size:** %d", message, newEvent.Event.TeamSize)
}
if newEvent.State >= stateDone {
message = fmt.Sprintf("%s\r\n\r\nDoes the above appear correct?", message)
}
// Add appliccable reaction legend
switch newEvent.State {
case stateNew:
fallthrough
case stateDate:
message = fmt.Sprintf("%s\r\n\r\n⏫ = Increase date by 1 month", message)
message = fmt.Sprintf("%s\r\n🔼 = Increase date by 1 day", message)
message = fmt.Sprintf("%s\r\n🔽 = Decrease date by 1 day", message)
message = fmt.Sprintf("%s\r\n⏬ = Decrease date by 1 month", message)
message = fmt.Sprintf("%s\r\n👍 = Continue", message)
message = fmt.Sprintf("%s\r\n❌ = Cancel", message)
case stateTime:
message = fmt.Sprintf("%s\r\n\r\n⏪ = Decrease time by 1 hour", message)
message = fmt.Sprintf("%s\r\n◀ = Decrease time by 10 minutes", message)
message = fmt.Sprintf("%s\r\n▶ = Increase time by 10 minutes", message)
message = fmt.Sprintf("%s\r\n⏩ = Increase time by 1 hour", message)
message = fmt.Sprintf("%s\r\n👍 = Continue", message)
message = fmt.Sprintf("%s\r\n❌ = Cancel", message)
case stateTimeZone:
message = fmt.Sprintf("%s\r\n\r\n Specify time zone", message)
message = fmt.Sprintf("%s\r\n❌ = Cancel", message)
case stateDuration:
message = fmt.Sprintf("%s\r\n\r\n :one: - :nine: Specify duration (in hours)", message)
message = fmt.Sprintf("%s\r\n❌ = Cancel", message)
case stateTeamSize:
message = fmt.Sprintf("%s\r\n\r\nSpecify team size:", message)
if newEvent.Event.TeamSize < 10 {
message = fmt.Sprintf("%s\r\n\r\n :one: - :nine: = 1 - 9", message)
message = fmt.Sprintf("%s\r\n ▶ = More than 9", message)
} else {
message = fmt.Sprintf("%s\r\n\r\n :zero: - :nine: = %d0 - %d9", message, newEvent.Event.TeamSize/10, newEvent.Event.TeamSize/10)
message = fmt.Sprintf("%s\r\n ◀ = Less than %d0", message, newEvent.Event.TeamSize/10)
message = fmt.Sprintf("%s\r\n ▶ = More than %d9", message, newEvent.Event.TeamSize/10)
}
//message = fmt.Sprintf("%s\r\n👍 = Continue", message)
message = fmt.Sprintf("%s\r\n❌ = Cancel", message)
case stateDone:
EditEvent(s, m, channel, newEvent.MessageID, "")
return
// message = fmt.Sprintf("%s\r\n✅ = OK", message)
// message = fmt.Sprintf("%s\r\n❌ = Cancel", message)
// message = fmt.Sprintf("%s\r\n🗓 = Back to Date", message)
// message = fmt.Sprintf("%s\r\n🕑 = Back to Time", message)
// message = fmt.Sprintf("%s\r\n🌍 = Back to Time Zone", message)
// message = fmt.Sprintf("%s\r\n⏳ = Back to Duration", message)
// message = fmt.Sprintf("%s\r\n👬 = Back to Team Size", message)
default:
}
// Post or update message
if newEvent.State == stateNew {
newMsg, _ := s.ChannelMessageSend(channel, message)
newEvent.MessageID = newMsg.ID
gv.escrowEvents[newMsg.ID] = newEvent
} else {
s.ChannelMessageEdit(channel, newEvent.MessageID, "")
s.ChannelMessageEdit(channel, newEvent.MessageID, message)
}
// Add appliccable reactions
s.MessageReactionsRemoveAll(channel, newEvent.MessageID)
switch newEvent.State {
case stateNew:
fallthrough
case stateDate:
s.MessageReactionAdd(channel, newEvent.MessageID, "⏫")
s.MessageReactionAdd(channel, newEvent.MessageID, "🔼")
s.MessageReactionAdd(channel, newEvent.MessageID, "🔽")
s.MessageReactionAdd(channel, newEvent.MessageID, "⏬")
s.MessageReactionAdd(channel, newEvent.MessageID, "👍")
s.MessageReactionAdd(channel, newEvent.MessageID, "❌")
case stateTime:
s.MessageReactionAdd(channel, newEvent.MessageID, "⏪")
s.MessageReactionAdd(channel, newEvent.MessageID, "◀")
s.MessageReactionAdd(channel, newEvent.MessageID, "▶")
s.MessageReactionAdd(channel, newEvent.MessageID, "⏩")
s.MessageReactionAdd(channel, newEvent.MessageID, "👍")
s.MessageReactionAdd(channel, newEvent.MessageID, "❌")
case stateTimeZone:
for emoji := range gv.tzByEmoji {
s.MessageReactionAdd(channel, newEvent.MessageID, emoji)
}
s.MessageReactionAdd(channel, newEvent.MessageID, "❌")
case stateDuration:
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiOne)
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiTwo)
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiThree)
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiFour)
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiFive)
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiSix)
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiSeven)
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiEight)
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiNine)
s.MessageReactionAdd(channel, newEvent.MessageID, "❌")
case stateTeamSize:
if newEvent.Event.TeamSize > 9 {
s.MessageReactionAdd(channel, newEvent.MessageID, "◀")
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiZero)
}
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiOne)
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiTwo)
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiThree)
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiFour)
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiFive)
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiSix)
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiSeven)
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiEight)
s.MessageReactionAdd(channel, newEvent.MessageID, EmojiNine)
s.MessageReactionAdd(channel, newEvent.MessageID, "▶")
//s.MessageReactionAdd(channel, newEvent.MessageID, "👍")
s.MessageReactionAdd(channel, newEvent.MessageID, "❌")
case stateDone:
s.MessageReactionAdd(channel, newEvent.MessageID, "✅")
s.MessageReactionAdd(channel, newEvent.MessageID, "❌")
s.MessageReactionAdd(channel, newEvent.MessageID, "🗓")
s.MessageReactionAdd(channel, newEvent.MessageID, "🕑")
s.MessageReactionAdd(channel, newEvent.MessageID, "🌍")
s.MessageReactionAdd(channel, newEvent.MessageID, "⏳")
s.MessageReactionAdd(channel, newEvent.MessageID, "👬")
default:
}
}
//gocyclo:ignore
// ProcessReaction is used to respond to reactions added by the user to an interactive new event
func ProcessReaction(s *discordgo.Session, m *discordgo.MessageReactionAdd) {
// Get channel
c, err := s.Channel(m.MessageReaction.ChannelID)
if err != nil {
s.ChannelMessageSend(m.MessageReaction.ChannelID, "EventsBot had trouble obtaining the channel information :no_mouth:")
return
}
// Find message in EscrowEvents
gv, ok := guildVarsMap[c.GuildID]
if !ok {
return
}
event, ok := gv.escrowEvents[m.MessageID]
if !ok {
return
}
log.Println(logging.LogEntry{
Severity: "DEBUG",
Message: fmt.Sprintf("%s reaction received for message %s", m.MessageReaction.Emoji.Name, event.MessageID),
})
// Respond to reaction based on state of developing event
switch event.State {
case stateNew:
fallthrough
case stateDate:
event.State = stateDate
switch m.MessageReaction.Emoji.Name {
case "⏫":
event.Event.DateTime = event.Event.DateTime.AddDate(0, 1, 0)
case "🔼":
event.Event.DateTime = event.Event.DateTime.AddDate(0, 0, 1)
case "🔽":
event.Event.DateTime = event.Event.DateTime.AddDate(0, 0, -1)
case "⏬":
event.Event.DateTime = event.Event.DateTime.AddDate(0, -1, 0)
case "👍":
if event.Committed {
event.State = stateDone
} else {
event.State = stateTime
}
case "❌":
delete(gv.escrowEvents, m.MessageID)
s.ChannelMessageDelete(m.MessageReaction.ChannelID, m.MessageID)
return
}
case stateTime:
switch m.MessageReaction.Emoji.Name {
case "⏪":
event.Event.DateTime = event.Event.DateTime.Add(-1 * time.Hour)
case "◀":
event.Event.DateTime = event.Event.DateTime.Add(-10 * time.Minute)
case "▶":
event.Event.DateTime = event.Event.DateTime.Add(10 * time.Minute)
case "⏩":
event.Event.DateTime = event.Event.DateTime.Add(1 * time.Hour)
case "👍":
if event.Committed {
event.State = stateDone
} else {
if event.Event.TimeZone != "" {
event.State = stateDuration
} else {
event.State = stateTimeZone
}
}
case "❌":
delete(gv.escrowEvents, m.MessageID)
s.ChannelMessageDelete(m.MessageReaction.ChannelID, m.MessageID)
return
}
case stateTimeZone:
timezone, ok := gv.tzByEmoji[m.MessageReaction.Emoji.Name]
if ok {
dtyr := event.Event.DateTime.Year()
dtmo := event.Event.DateTime.Month()
dtda := event.Event.DateTime.Day()
dtho := event.Event.DateTime.Hour()
dtmi := event.Event.DateTime.Minute()
event.Event.TimeZone = timezone.Abbrev
location, _ := time.LoadLocation(timezone.Location)
event.Event.DateTime = time.Date(dtyr, dtmo, dtda, dtho, dtmi, 0, 0, location)
if event.Committed {
event.State = stateDone
} else {
event.State = stateDuration
}
}
if m.MessageReaction.Emoji.Name == "❌" {
delete(gv.escrowEvents, m.MessageID)
s.ChannelMessageDelete(m.MessageReaction.ChannelID, m.MessageID)
return
}
case stateDuration:
if event.Committed {
event.State = stateDone
} else {
event.State = stateTeamSize
}
switch m.MessageReaction.Emoji.Name {
case EmojiOne:
event.Event.Duration = 1
case EmojiTwo:
event.Event.Duration = 2
case EmojiThree:
event.Event.Duration = 3
case EmojiFour:
event.Event.Duration = 4
case EmojiFive:
event.Event.Duration = 5
case EmojiSix:
event.Event.Duration = 6
case EmojiSeven:
event.Event.Duration = 7
case EmojiEight:
event.Event.Duration = 8
case EmojiNine:
event.Event.Duration = 9
case "❌":
delete(gv.escrowEvents, m.MessageID)
s.ChannelMessageDelete(m.MessageReaction.ChannelID, m.MessageID)
return
default:
event.State = stateDuration
}
case stateTeamSize:
event.State = stateDone
baseSize := (event.Event.TeamSize / 10) * 10
switch m.MessageReaction.Emoji.Name {
case EmojiZero:
event.Event.TeamSize = baseSize + 1
case EmojiOne:
event.Event.TeamSize = baseSize + 1
case EmojiTwo:
event.Event.TeamSize = baseSize + 2
case EmojiThree:
event.Event.TeamSize = baseSize + 3
case EmojiFour:
event.Event.TeamSize = baseSize + 4
case EmojiFive:
event.Event.TeamSize = baseSize + 5
case EmojiSix:
event.Event.TeamSize = baseSize + 6
case EmojiSeven:
event.Event.TeamSize = baseSize + 7
case EmojiEight:
event.Event.TeamSize = baseSize + 8
case EmojiNine:
event.Event.TeamSize = baseSize + 9
case "◀":
if baseSize >= 10 {
event.Event.TeamSize = baseSize - 10
if event.Event.TeamSize <= 0 {
event.Event.TeamSize = 1
}
}
event.State = stateTeamSize
case "▶":
event.Event.TeamSize = baseSize + 10
event.State = stateTeamSize
//case "👍":
// event.State = stateDone
case "❌":
delete(gv.escrowEvents, m.MessageID)
s.ChannelMessageDelete(m.MessageReaction.ChannelID, m.MessageID)
return
default:
event.State = stateTeamSize
}
case stateDone:
switch m.MessageReaction.Emoji.Name {
case "🗓":
event.State = stateDate
case "🕑":
event.State = stateTime
case "🌍":
event.State = stateTimeZone
case "⏳":
event.State = stateDuration
case "👬":
event.State = stateTeamSize
case "✅":
CommitEvent(s, m.MessageReaction.ChannelID, event)
fallthrough
case "❌":
delete(gv.escrowEvents, m.MessageID)
s.ChannelMessageDelete(m.MessageReaction.ChannelID, m.MessageID)
return
}
}
gv.escrowEvents[m.MessageID] = event
ShowDevelopingEvent(s, nil, m.MessageReaction.ChannelID, event)
}
// CommitEvent is used to move an event from Escrow to the DB
func CommitEvent(s *discordgo.Session, channelID string, newEvent developingEvent) {
// Get channel
channel, err := s.Channel(channelID)
if err != nil {
s.ChannelMessageSend(channelID, "EventsBot had trouble obtaining the channel information :no_mouth:")
return
}
// Get guild
guild, err := s.Guild(channel.GuildID)
if err != nil {
s.ChannelMessageSend(channelID, "EventsBot had trouble obtaining the guild information :no_mouth:")
return
}
err = db.UpdateEvent(channel.GuildID, newEvent.Event)
if err != nil {
s.ChannelMessageSend(channelID, ":scream::scream::scream:Something very weird happened when trying to create this event. Sorry but EventsBot has no answers for you :cry:")
return
}
if !newEvent.Committed {
message := fmt.Sprintf("Woohoo! A new event has been created by %s. EventsBot is most pleased :ok_hand:", newEvent.Event.Creator.Mention())
message = fmt.Sprintf("%s\r\nEvent ID: **%s**", message, newEvent.Event.EventID)
message = fmt.Sprintf("%s\r\n\r\nTo sign up for this event, type the following:", message)
message = fmt.Sprintf("%s\r\n```%ssignup %s```", message, config.CommandPrefix, newEvent.Event.EventID)
s.ChannelMessageSend(channelID, message)
signupCmd := []string{"signup", newEvent.Event.EventID}
Signup(guild, s, newEvent.TriggerMessage, signupCmd)
} else {
message := fmt.Sprintf("Yeah boi! %s has successfully modified event %s. EventsBot is impressed :ok_hand:", newEvent.Event.Creator.Mention(), newEvent.Event.EventID)
s.ChannelMessageSend(channelID, message)
detailsCmd := []string{"details", newEvent.Event.EventID}
Details(guild, s, newEvent.TriggerMessage, detailsCmd)
}
}
// EditEvent is used to change the details of an event
func EditEvent(s *discordgo.Session, m *discordgo.MessageCreate, channelID string, messageID string, eventID string) {
var devEvt developingEvent
// Get channel
c, err := s.Channel(channelID)
if err != nil {
s.ChannelMessageSend(channelID, "EventsBot had trouble obtaining the channel information :no_mouth:")
return
}
// Find message in EscrowEvents
gv, ok := guildVarsMap[c.GuildID]
if !ok {
return
}
_, ok = gv.escrowEvents[messageID]
if !ok {
// If no event is found in escrow for the specified message, it could mean that it's referring to an event already in the db and needs to be pulled from there
event, err := db.GetEvent(c.GuildID, eventID)
if err == errNoRecords {
s.ChannelMessageSend(channelID, fmt.Sprintf("EventsBot could find no such event. Are you sure you got that Event ID of %s right? Them's finicky numbers. :grimacing:", eventID))
return
} else if err != nil {
log.Println(logging.LogEntry{
Severity: "ERROR",
Message: fmt.Sprintf("database: %+v", err),
})
s.ChannelMessageSend(channelID, ":scream::scream::scream:Something very weird happened when trying to edit this event. Sorry but EventsBot has no answers for you :cry:")
return
}
newEvent := developingEvent{
TriggerMessage: m,
MessageID: messageID,
State: stateDone,
Event: *event,
Committed: true,
}
gv.escrowEvents[messageID] = newEvent
devEvt = newEvent
}
devEvt, ok = gv.escrowEvents[messageID]
if !ok {
s.ChannelMessageSend(channelID, "EventsBot had trouble interpreting the developing event. This is one of those things that should happen but then they do. :face_with_spiral_eyes:")
return
}
// Get time zone
tzInfo := ""
eventLocation := defaultLocation
if devEvt.Event.TimeZone != "" {
tz, ok := gv.tzByAbbr[devEvt.Event.TimeZone]
if !ok {
s.ChannelMessageSend(channelID, "EventsBot had trouble interpreting the time zone information of this event. Are we anywhere near a worm hole perhaps? :no_mouth:")
return
}
tzInfo = tz.Abbrev
eventLocation, _ = time.LoadLocation(tz.Location)
}
// Construct message
message := "EDIT EVENT"
message = fmt.Sprintf("%s\r\n**Creator:** %s", message, devEvt.Event.Creator.Mention())
message = fmt.Sprintf("%s\r\n**Name:** %s", message, devEvt.Event.Name)
message = fmt.Sprintf("%s\r\n**Date:** %s", message, devEvt.Event.DateTime.In(eventLocation).Format("Mon 2 Jan 2006"))
message = fmt.Sprintf("%s\r\n**Time:** %s", message, devEvt.Event.DateTime.In(eventLocation).Format("15:04"))
if devEvt.Event.TimeZone != "" {
message = fmt.Sprintf("%s (%s)", message, tzInfo)
}
message = fmt.Sprintf("%s\r\n**Duration:** %d", message, devEvt.Event.Duration)
message = fmt.Sprintf("%s\r\n**Team Size:** %d", message, devEvt.Event.TeamSize)
message = fmt.Sprintf("%s\r\n\r\nDoes the above appear correct?", message)
message = fmt.Sprintf("%s\r\n✅ = OK", message)
message = fmt.Sprintf("%s\r\n❌ = Cancel", message)
message = fmt.Sprintf("%s\r\n🗓 = Change Date", message)
message = fmt.Sprintf("%s\r\n🕑 = Change Time", message)
message = fmt.Sprintf("%s\r\n🌍 = Change Time Zone", message)
message = fmt.Sprintf("%s\r\n⏳ = Change Duration", message)
message = fmt.Sprintf("%s\r\n👬 = Change Team Size", message)
// Post or update message
if messageID == "" {
newMsg, _ := s.ChannelMessageSend(channelID, message)
gv.escrowEvents[newMsg.ID] = devEvt
} else {
s.ChannelMessageEdit(channelID, messageID, "")
s.ChannelMessageEdit(channelID, messageID, message)
}
// Add appliccable reactions
s.MessageReactionsRemoveAll(channelID, devEvt.MessageID)
s.MessageReactionAdd(channelID, devEvt.MessageID, "✅")
s.MessageReactionAdd(channelID, devEvt.MessageID, "❌")
s.MessageReactionAdd(channelID, devEvt.MessageID, "🗓")
s.MessageReactionAdd(channelID, devEvt.MessageID, "🕑")
s.MessageReactionAdd(channelID, devEvt.MessageID, "🌍")
s.MessageReactionAdd(channelID, devEvt.MessageID, "⏳")
s.MessageReactionAdd(channelID, devEvt.MessageID, "👬")
}