Confessions module
This commit adds a confessions feature that allows users to mark a "confessional" channel and also to post anonymously to it. The changes that this comprises of are as follows: - New discord "slash" commands for both marking a confessional and posting to it - a bunch of stuff in the discord module to register and deregister "slash" commands - New event type to track marked confessionals - confession module that processes new confession channel links and also posts confessions to corresponding confessionals Not included in this commit: - a way to cleanup obsolete or reconfigured confession channel links - access control for the confessional slash commands Signed-off-by: Ava Affine <ava@sunnypup.io>
This commit is contained in:
parent
720b80679a
commit
430c0afaa6
6 changed files with 253 additions and 0 deletions
|
|
@ -226,3 +226,47 @@ func (te TestEvent) Validate() error {
|
|||
func (te TestEvent) Disposable() bool {
|
||||
return te.Dispose
|
||||
}
|
||||
|
||||
const (
|
||||
ConfessionsLinkEventGuildKey = "guild_id"
|
||||
ConfessionsLinkEventChannelKey = "channel_id"
|
||||
ConfessionsLinkEventCreatedKey = "created"
|
||||
ConfessionsLinkEventObsoleteKey = "obsolete"
|
||||
|
||||
BadConfessionsLinkEventError = "link event doesnt have required fields"
|
||||
)
|
||||
|
||||
type ConfessionsChannelLinkEvent struct {
|
||||
GuildID string
|
||||
ChannelID string
|
||||
Created time.Time
|
||||
}
|
||||
|
||||
func (e ConfessionsChannelLinkEvent) Type() EventType {
|
||||
return ConfessionsChannelLink
|
||||
}
|
||||
|
||||
func (e ConfessionsChannelLinkEvent) Time() time.Time {
|
||||
return e.Time()
|
||||
}
|
||||
|
||||
func (e ConfessionsChannelLinkEvent) Data() map[string]string {
|
||||
return map[string]string{
|
||||
ConfessionsLinkEventGuildKey: e.GuildID,
|
||||
ConfessionsLinkEventChannelKey: e.ChannelID,
|
||||
ConfessionsLinkEventCreatedKey: e.Created.Format(time.RFC3339),
|
||||
}
|
||||
}
|
||||
|
||||
func (e ConfessionsChannelLinkEvent) Validate() error {
|
||||
if len(e.ChannelID) > 1 || len(e.GuildID) > 1 {
|
||||
return errors.New(BadConfessionsLinkEventError)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e ConfessionsChannelLinkEvent) Disposable() bool {
|
||||
// TODO
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue