Documentation ¶
Index ¶
- Constants
- func NewService(logger zerolog.Logger, childBotHost, childBotPort, childTokenPathPrefix string, ...) *service
- type Bot
- type Item
- type Keyword
- type Repo
- func (r *Repo) CountByUserID(c context.Context, userID primitive.ObjectID) (int64, error)
- func (r *Repo) Create(c context.Context, userID primitive.ObjectID, token string) error
- func (r *Repo) Delete(c context.Context, userID, id primitive.ObjectID) error
- func (r *Repo) Get(c context.Context) chan Item
- func (r *Repo) GetByToken(c context.Context, token string) (Bot, bool, error)
- func (r *Repo) GetByUserID(c context.Context, userID primitive.ObjectID) ([]Bot, error)
- func (r *Repo) SetKeywordsAndMode(c context.Context, id primitive.ObjectID, keywords []Keyword, mode mode) error
- func (r *Repo) SetOnPeerStart(c context.Context, id primitive.ObjectID, onPeerStart string) error
- func (r *Repo) SetSetupDoneTrue(c context.Context, id primitive.ObjectID) error
- func (r *Repo) SetUserChatID(c context.Context, id primitive.ObjectID, userChatID int64) error
- func (r *Repo) SetWebhookNow(c context.Context, id primitive.ObjectID) error
Constants ¶
View Source
const ( None mode = iota OnlyFirst Always )
Variables ¶
This section is empty.
Functions ¶
func NewService ¶
func NewService( logger zerolog.Logger, childBotHost, childBotPort, childTokenPathPrefix string, childStateRepo *child_state.Repo, userRepo *user.Repo, peerRepo *peer.Repo, childBotRepo *Repo, replyRepo *reply.Repo, keywordsLimitPerBot, inLimitPerKeyword, inLimitChars, outLimitChars uint16, parentBotUsername string, setWebhooks, timeoutOnHandle bool, ) *service
Types ¶
type Bot ¶
type Bot struct { ID primitive.ObjectID `bson:"_id,omitempty"` OwnerUserID primitive.ObjectID `bson:"ui,omitempty"` OwnerUserChatID int64 `bson:"uci,omitempty"` Token string `bson:"t,omitempty"` SetupDone bool `bson:"sd,omitempty"` OnPeerStart string `bson:"ops,omitempty"` Keywords []Keyword `bson:"k,omitempty"` WebhookAt time.Time `bson:"wa,omitempty"` Mode mode `bson:"m,omitempty"` }
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
func (*Repo) CountByUserID ¶
func (*Repo) GetByToken ¶
func (*Repo) GetByUserID ¶
func (*Repo) SetKeywordsAndMode ¶
func (*Repo) SetOnPeerStart ¶
func (*Repo) SetSetupDoneTrue ¶
func (*Repo) SetUserChatID ¶
Click to show internal directories.
Click to hide internal directories.