Documentation ¶
Overview ¶
Package telebot is a generated GoMock package.
Index ¶
- func CancelBillBtn(billID uint) telebot.Btn
- func NewBot(settings telebot.Settings, hub *HandlersHub) (*telebot.Bot, error)
- func NextDayBillBtn(year, month, day int) telebot.Btn
- func NextMonthBillBtn(year, month int) telebot.Btn
- func ParseBill(text string) (string, *string)
- func PrevDayBillBtn(year, month, day int) telebot.Btn
- func PrevMonthBillBtn(year, month int) telebot.Btn
- func RegisterHandlers(bot *telebot.Bot, hub *HandlersHub)
- type BillCreatedTemplate
- type BillListTemplate
- type CancelBillData
- type DateBillsSender
- type DateTitleTemplate
- type DayBillBtnData
- type HandlersHub
- func (hub *HandlersHub) HandleBalanceCommand(ctx telebot.Context) error
- func (hub *HandlersHub) HandleCancelBillCallback(ctx telebot.Context) error
- func (hub *HandlersHub) HandleCancelCommand(ctx telebot.Context) error
- func (hub *HandlersHub) HandleCreateTokenCommand(ctx telebot.Context) error
- func (hub *HandlersHub) HandleDayBillSelectionCallback(ctx telebot.Context) error
- func (hub *HandlersHub) HandleDayCommand(ctx telebot.Context) error
- func (hub *HandlersHub) HandleDisableAllTokensCommand(ctx telebot.Context) error
- func (hub *HandlersHub) HandleHelpCommand(ctx telebot.Context) error
- func (hub *HandlersHub) HandleMonthBillSelectionCallback(ctx telebot.Context) error
- func (hub *HandlersHub) HandleMonthCommand(ctx telebot.Context) error
- func (hub *HandlersHub) HandleSetBalanceCommand(ctx telebot.Context) error
- func (hub *HandlersHub) HandleSetKeyboardCommand(ctx telebot.Context) error
- func (hub *HandlersHub) HandleStartCommand(ctx telebot.Context) error
- func (hub *HandlersHub) HandleText(ctx telebot.Context) error
- func (hub *HandlersHub) OnCreatingBill(ctx telebot.Context, userState *UserState) error
- func (hub *HandlersHub) OnEmpty(ctx telebot.Context) error
- func (hub *HandlersHub) OnSettingKeyboard(ctx telebot.Context) error
- type InMemoryUserStateManager
- type MockUserStateManager
- type MockUserStateManagerMockRecorder
- type MonthBillBtnData
- type MonthBillsSender
- type MonthTitleTemplate
- type NewBillSender
- type Template
- type UserState
- type UserStateManager
- type UserStateType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBot ¶
func NewBot(settings telebot.Settings, hub *HandlersHub) (*telebot.Bot, error)
func NextDayBillBtn ¶
func NextDayBillBtn(year, month, day int) telebot.Btn
NextDayBillBtn 根据传入的年月日,生成用于将账单切换到后一天的按钮
func NextMonthBillBtn ¶
func NextMonthBillBtn(year, month int) telebot.Btn
func PrevDayBillBtn ¶
func PrevDayBillBtn(year, month, day int) telebot.Btn
PrevDayBillBtn 根据传入的年月日,生成用于将账单切换到前一天的按钮
func PrevMonthBillBtn ¶
func PrevMonthBillBtn(year, month int) telebot.Btn
func RegisterHandlers ¶
func RegisterHandlers(bot *telebot.Bot, hub *HandlersHub)
Types ¶
type BillCreatedTemplate ¶
type BillCreatedTemplate struct {
// contains filtered or unexported fields
}
func (*BillCreatedTemplate) Render ¶
func (template *BillCreatedTemplate) Render() string
type BillListTemplate ¶
type BillListTemplate struct { Bills []*models.Bill MergeCategory bool // 对相同类别的账单求总和后展示 ShowSub bool // 显示净增值 }
func (*BillListTemplate) Render ¶
func (template *BillListTemplate) Render() string
type CancelBillData ¶
type CancelBillData struct {
BillID uint
}
type DateBillsSender ¶
func (*DateBillsSender) ReplyMarkup ¶
func (sender *DateBillsSender) ReplyMarkup() *telebot.ReplyMarkup
func (*DateBillsSender) Send ¶
func (sender *DateBillsSender) Send(bot *telebot.Bot, recipient telebot.Recipient, _ *telebot.SendOptions) (*telebot.Message, error)
func (*DateBillsSender) Text ¶
func (sender *DateBillsSender) Text() string
type DateTitleTemplate ¶
func (*DateTitleTemplate) Render ¶
func (template *DateTitleTemplate) Render() string
type DayBillBtnData ¶
type DayBillBtnData struct {
Year, Month, Day int
}
type HandlersHub ¶
type HandlersHub struct {
// contains filtered or unexported fields
}
func NewHandlerHub ¶
func NewHandlerHub(billService *bill.Service, teleService *telegram.Service, userService *user.Service, userStateManager UserStateManager) *HandlersHub
func (*HandlersHub) HandleBalanceCommand ¶
func (hub *HandlersHub) HandleBalanceCommand(ctx telebot.Context) error
func (*HandlersHub) HandleCancelBillCallback ¶
func (hub *HandlersHub) HandleCancelBillCallback(ctx telebot.Context) error
func (*HandlersHub) HandleCancelCommand ¶
func (hub *HandlersHub) HandleCancelCommand(ctx telebot.Context) error
func (*HandlersHub) HandleCreateTokenCommand ¶
func (hub *HandlersHub) HandleCreateTokenCommand(ctx telebot.Context) error
func (*HandlersHub) HandleDayBillSelectionCallback ¶
func (hub *HandlersHub) HandleDayBillSelectionCallback(ctx telebot.Context) error
HandleDayBillSelectionCallback 处理切换日期账单的回调事件
func (*HandlersHub) HandleDayCommand ¶
func (hub *HandlersHub) HandleDayCommand(ctx telebot.Context) error
func (*HandlersHub) HandleDisableAllTokensCommand ¶
func (hub *HandlersHub) HandleDisableAllTokensCommand(ctx telebot.Context) error
func (*HandlersHub) HandleHelpCommand ¶
func (hub *HandlersHub) HandleHelpCommand(ctx telebot.Context) error
func (*HandlersHub) HandleMonthBillSelectionCallback ¶
func (hub *HandlersHub) HandleMonthBillSelectionCallback(ctx telebot.Context) error
HandleMonthBillSelectionCallback 处理切换月度账单的回调事件
func (*HandlersHub) HandleMonthCommand ¶
func (hub *HandlersHub) HandleMonthCommand(ctx telebot.Context) error
func (*HandlersHub) HandleSetBalanceCommand ¶
func (hub *HandlersHub) HandleSetBalanceCommand(ctx telebot.Context) error
func (*HandlersHub) HandleSetKeyboardCommand ¶
func (hub *HandlersHub) HandleSetKeyboardCommand(ctx telebot.Context) error
func (*HandlersHub) HandleStartCommand ¶
func (hub *HandlersHub) HandleStartCommand(ctx telebot.Context) error
func (*HandlersHub) HandleText ¶
func (hub *HandlersHub) HandleText(ctx telebot.Context) error
func (*HandlersHub) OnCreatingBill ¶
func (hub *HandlersHub) OnCreatingBill(ctx telebot.Context, userState *UserState) error
func (*HandlersHub) OnEmpty ¶
func (hub *HandlersHub) OnEmpty(ctx telebot.Context) error
func (*HandlersHub) OnSettingKeyboard ¶
func (hub *HandlersHub) OnSettingKeyboard(ctx telebot.Context) error
type InMemoryUserStateManager ¶
type InMemoryUserStateManager struct {
// contains filtered or unexported fields
}
func NewInMemoryUserStateManager ¶
func NewInMemoryUserStateManager() *InMemoryUserStateManager
func (*InMemoryUserStateManager) ClearUserState ¶
func (manager *InMemoryUserStateManager) ClearUserState(userID int64) error
func (*InMemoryUserStateManager) GetUserState ¶
func (manager *InMemoryUserStateManager) GetUserState(userID int64) (state *UserState, err error)
func (*InMemoryUserStateManager) SetUserState ¶
func (manager *InMemoryUserStateManager) SetUserState(userID int64, state *UserState) error
type MockUserStateManager ¶
type MockUserStateManager struct {
// contains filtered or unexported fields
}
MockUserStateManager is a mock of UserStateManager interface.
func NewMockUserStateManager ¶
func NewMockUserStateManager(ctrl *gomock.Controller) *MockUserStateManager
NewMockUserStateManager creates a new mock instance.
func (*MockUserStateManager) ClearUserState ¶
func (m *MockUserStateManager) ClearUserState(userID int64) error
ClearUserState mocks base method.
func (*MockUserStateManager) EXPECT ¶
func (m *MockUserStateManager) EXPECT() *MockUserStateManagerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockUserStateManager) GetUserState ¶
func (m *MockUserStateManager) GetUserState(userID int64) (*UserState, error)
GetUserState mocks base method.
func (*MockUserStateManager) SetUserState ¶
func (m *MockUserStateManager) SetUserState(userID int64, state *UserState) error
SetUserState mocks base method.
type MockUserStateManagerMockRecorder ¶
type MockUserStateManagerMockRecorder struct {
// contains filtered or unexported fields
}
MockUserStateManagerMockRecorder is the mock recorder for MockUserStateManager.
func (*MockUserStateManagerMockRecorder) ClearUserState ¶
func (mr *MockUserStateManagerMockRecorder) ClearUserState(userID interface{}) *gomock.Call
ClearUserState indicates an expected call of ClearUserState.
func (*MockUserStateManagerMockRecorder) GetUserState ¶
func (mr *MockUserStateManagerMockRecorder) GetUserState(userID interface{}) *gomock.Call
GetUserState indicates an expected call of GetUserState.
func (*MockUserStateManagerMockRecorder) SetUserState ¶
func (mr *MockUserStateManagerMockRecorder) SetUserState(userID, state interface{}) *gomock.Call
SetUserState indicates an expected call of SetUserState.
type MonthBillBtnData ¶
type MonthBillBtnData struct {
Year, Month int
}
type MonthBillsSender ¶
func (*MonthBillsSender) ReplyMarkup ¶
func (sender *MonthBillsSender) ReplyMarkup() *telebot.ReplyMarkup
func (*MonthBillsSender) Send ¶
func (sender *MonthBillsSender) Send(bot *telebot.Bot, recipient telebot.Recipient, _ *telebot.SendOptions) (*telebot.Message, error)
func (*MonthBillsSender) Text ¶
func (sender *MonthBillsSender) Text() string
type MonthTitleTemplate ¶
func (*MonthTitleTemplate) Render ¶
func (template *MonthTitleTemplate) Render() string
type NewBillSender ¶
type NewBillSender struct {
// contains filtered or unexported fields
}
func (*NewBillSender) Send ¶
func (sender *NewBillSender) Send(bot *telebot.Bot, recipient telebot.Recipient, _ *telebot.SendOptions) (*telebot.Message, error)
type UserState ¶
type UserState struct { Type UserStateType `json:"type"` // Type 为 CreatingBill 时不为空 BillCategory *string `json:"bill_category"` // Type 为 CreatingBill 时可能有值,若为空则代表未设置名称 BillName *string `json:"bill_name"` }
type UserStateManager ¶
type UserStateType ¶
type UserStateType string
const ( Empty UserStateType = "empty" CreatingBill UserStateType = "creatingBill" SettingKeyboard UserStateType = "settingKeyboard" )