-
Notifications
You must be signed in to change notification settings - Fork 20
/
hi_man.v
28 lines (25 loc) · 803 Bytes
/
hi_man.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module main
import dariotarantini.vgram
fn main(){
bot := vgram.new_bot('TELEGRAM_BOT_TOKEN_HERE')
mut updates := []vgram.Update{}
mut last_offset := 0
for {
updates = bot.get_updates(offset: last_offset, limit: 100)
for update in updates {
if last_offset < update.update_id {
last_offset = update.update_id
if update.message.text == "/start" {
bot.send_chat_action(
chat_id: update.message.from.id.str(),
action: "typing"
)
bot.send_message(
chat_id: update.message.from.id.str(),
text: 'Hi man'
)
}
}
}
}
}