telebot.im
AsycTelegramBotAPIClietimplemeti@Nim-Lag
NotesFromversio1.0.0,procslikesewMessage,ewPhoto,..aregoe,usesedMessage,sedDocumetistead.Ifyoustillprefertheold/uglywaytosedstuffs,justimporttelebot/compatforbackwardcompatible
Istallatio$imbleistalltelebotUsageechobotimporttelebot,asycdispatch,loggig,optiosvarL=ewCosoleLogger(fmtStr="$levelame,[$time]")addHadler(L)costAPI_KEY=slurp("secret.key")procupdateHadler(b:Telebot,u:Update):Future[bool]{.asyc.}=ifotu.message.isSome:#returtruewillmakebotstopprocessothercallbacksreturtruevarrespose=u.message.getifrespose.text.isSome:lettext=respose.text.getdiscardawaitb.sedMessage(respose.chat.id,text,parseMode="markdow",disableNotificatio=true,replyToMessageId=respose.messageId)letbot=ewTeleBot(API_KEY)bot.oUpdate(updateHadler)bot.poll(timeout=300)sedlocalphotoimporttelebot,asycdispatch,optios,loggigcostAPI_KEY=slurp("secret.key")procupdateHadler(bot:TeleBot,update:Update):Future[bool]{.asyc.}=discardawaitbot.sedPhoto(respose.chat.id,"file:///path/to/photo.jpg")letbot=ewTeleBot(API_KEY)bot.oUpdate(updateHadler)bot.poll(timeout=300)FormoreiformatiopleaserefertoofficialTelegramBotAPIpage







评论