aboutsummaryrefslogtreecommitdiff
path: root/cmd/mimi/modules/irc/post.go
blob: e80bd343069c636328d1d640db575582b99e71d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package irc

import (
	"context"

	"github.com/twitchtv/twirp"
	"google.golang.org/protobuf/types/known/emptypb"
	"within.website/x/proto/mimi/announce"
)

type PostService struct {
	*Module
}

func (a *PostService) Post(ctx context.Context, su *announce.StatusUpdate) (*emptypb.Empty, error) {
	a.conn.Privmsgf(*ircChannel, "%s", su.Body)

	if _, err := a.dg.ChannelMessageSend(*discordPOSSEAnnounceChannel, su.Body); err != nil {
		return nil, twirp.InternalErrorWith(err).WithMeta("step", "discord")
	}

	return &emptypb.Empty{}, nil
}