birdbot/discord/event.go
Layla Manley 696ab7201c
Major Refactor (#2)
* Major reworks

* More refactoring

* Refactor feature complete!

* Comments

* Add versioning
2022-10-28 23:08:17 -04:00

29 lines
705 B
Go

package discord
import (
"github.com/bwmarrin/discordgo"
"github.com/yeslayla/birdbot/core"
)
// NewEvent converts a discordgo.GuildScheduledEvent to birdbot event
func NewEvent(guildEvent *discordgo.GuildScheduledEvent) *core.Event {
event := &core.Event{
Name: guildEvent.Name,
ID: guildEvent.ID,
Organizer: &core.User{
ID: guildEvent.CreatorID,
},
DateTime: guildEvent.ScheduledStartTime,
}
event.Completed = guildEvent.Status == discordgo.GuildScheduledEventStatusCompleted
if guildEvent.EntityType != discordgo.GuildScheduledEventEntityTypeExternal {
event.Location = core.REMOTE_LOCATION
} else {
event.Location = guildEvent.EntityMetadata.Location
}
return event
}