# Discord Server Governance Sync Declarative channels (Discord-Server-as-Code DSaC) ``` discord/channels.yaml ``` ```go type DiscordChannels struct { Categories []Category }//we will need this only if we make one big yaml file type DiscordCategory struct { Name string `yaml:"category"` Private bool `yaml:"private"` Archived bool `yaml:"archived"` Roles []string `yaml:"roles"` Members []string `yaml:"members"` Channels []DiscordChannel `yaml:"channels"` } type DiscordChannelType string const ( DiscordChannelText DiscordChannelType = "text" DiscordChannelVoice = "voice" /*There are multiple channel types that we can use e. g. news channel, threads (private or public), forum For now I think that we can keep the two types and add other types afterwards */ ) type DiscordChannel struct { Name string `yaml:"name"` Emoji string `yaml:"emoji"` Description string `yaml:"description"` Private bool `yaml:"private"` Archived bool `yaml:"archived"` Type []DiscordChannelType `yaml:"type"` //if we have multiple types, we can list them and store them in the array Roles []string `yaml:"roles"` Members []string `yaml:"members"` /*The members need to be stored only if the channel is private */ } func ChannelTypes() map[string]discordgo.ChannelType { "text": ChannelTypeGuildText, "voice": ChannelTypeGuildVoice, "category": ChannelTypeGuildCategory, "news": ChannelTypeGuildNews, "store": ChannelTypeGuildStore, "news-thread": ChannelTypeGuildNewsThread, "public-thread": ChannelTypeGuildPublicThread, "private-thread": ChannelTypeGuildPrivateThread, "stage-voice": ChannelTypeGuildStageVoice, "forum": ChannelTypeGuildForum, } // Usage example: channelType := "text" channelType, ok := DiscordTypes()[channelType] if !ok { return fmt.Errorf("unsupported channel type: %s", channelType) } ``` `contributors.yaml` ```yaml contributors: - id: unikraft-bot name: Unikraft Bot emails: - monkey@unikraft.io github: unikraft-bot discord: "UnikraftBot#1234" role: affiliations: - Unikraft OSS Project ``` Rename `internal/users` => `internal/contributors` `internal/contributors/contributor.go` ```go type Contributor struct { Id string `yaml:"id,omitempty"` Name string `yaml:"name,omitempty"` Emails []string `yaml:"emails"` Role ContributorRole `yaml:""` Github string `yaml:"github"` Discord string `yaml:"discord"` } type Contributors struct { Contributors []Contributor `yaml:"contributors"` } ``` ```yaml - category: Hackathons private: false channels: - name: hack-porto23 emoji: 🇵🇹 description: Unikraft Porto Hackathon 2023 private: false # this is inherited if true archive: true type: text roles: - sig-api members: - username # we should not accommodate threads, they are too ephemeral # threads: # - thread1 - category: Announcements private: false roles: - ... - ... members: - ... - category: Information private: false channels: - name: Archived channel archived: true # prevents users from sending messages ``` * Special category "Archived" (ordered last)