Add LICENSE and first command
This commit may be used as template for making any new Telegram bots. Just check out it, change your variables and start developing new shiny bot! Maybe I need to create bot generator...
This commit is contained in:
25
domains/commands/v1/exported.go
Normal file
25
domains/commands/v1/exported.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// Fantasy World Zookeeper Bot
|
||||
// Copyright (c) 2018 Vladimir "fat0troll" Hodakov
|
||||
|
||||
package commandsv1
|
||||
|
||||
import (
|
||||
"github.com/rs/zerolog"
|
||||
"lab.wtfteam.pro/fat0troll/fw_zookeeper/context"
|
||||
"lab.wtfteam.pro/fat0troll/fw_zookeeper/internal/router"
|
||||
)
|
||||
|
||||
var (
|
||||
c *context.Context
|
||||
log zerolog.Logger
|
||||
)
|
||||
|
||||
// New initializes package
|
||||
func New(cc *context.Context) {
|
||||
c = cc
|
||||
log = c.Logger.With().Str("domain", "commands").Int("version", 1).Logger()
|
||||
|
||||
router.RegisterPrivateCommand("start", StartCommand)
|
||||
|
||||
log.Info().Msg("Domain «commands» initialized")
|
||||
}
|
16
domains/commands/v1/start.go
Normal file
16
domains/commands/v1/start.go
Normal file
@@ -0,0 +1,16 @@
|
||||
// Fantasy World Zookeeper Bot
|
||||
// Copyright (c) 2018 Vladimir "fat0troll" Hodakov
|
||||
|
||||
package commandsv1
|
||||
|
||||
import (
|
||||
"gitlab.com/toby3d/telegram"
|
||||
itelegram "lab.wtfteam.pro/fat0troll/fw_zookeeper/internal/telegram"
|
||||
)
|
||||
|
||||
// StartCommand responds to /start message
|
||||
func StartCommand(update *telegram.Update) {
|
||||
message := "*Hello, hello, hello*"
|
||||
|
||||
itelegram.RespondWithMarkdown(update.Message.Chat.ID, message)
|
||||
}
|
Reference in New Issue
Block a user