telegram-bot-boilerplate | Boilerplate express application for building telegram bots | Bot library
kandi X-RAY | telegram-bot-boilerplate Summary
kandi X-RAY | telegram-bot-boilerplate Summary
Boilerplate express application for building telegram bots
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of telegram-bot-boilerplate
telegram-bot-boilerplate Key Features
telegram-bot-boilerplate Examples and Code Snippets
Community Discussions
Trending Discussions on telegram-bot-boilerplate
QUESTION
I'm new on Elixir and I write telegram bot. I use this project as template: https://github.com/lubien/elixir-telegram-bot-boilerplate
It works fine, but I have a couple of questions.
How can I split "Commands" if it would be too big? I have an idea to create a new module NewCommands with
use App.Commander
and add it tohandle_cast
in Matcher. Is that a right way?Why does Matcher runs as a GenServer? I don't think it needs any state or smth.
ANSWER
Answered 2017-Jan-14 at 06:24- Please start with reading about the difference between
use
,import
, andrequire
in Elixir.
We use
import
whenever we want to easily access functions or macros from other modules without using the fully-qualified name.
So no, use
should not be used here: import
should. Other way round would be to define commands as macros and require
them, or write an ad-hoc function generation inside __using__
macro of NewCommands
and only then use
it.
- I did not dig into the code, but I guess you want
Matcher
to be automatically respawned is something went wrong and it crashed, right? Erlang philosophy is “crash soon,” hence instead of cumbersome error handling we just let the process crash. Aftwerwards, if you still want to match, it should be respawned, to serve further requests.
Also, it is used as a dispatcher before Commands
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install telegram-bot-boilerplate
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page