Comments (21)
Are you running the latest version of the bot? It looks like the telegrambot library is not passing the error message up to the hubot adapter, I will have a look at that.
I encountered this before when I used the wrong telegram authentication token or possibly when you are running your bot in "poll" mode while you have a webhook active.
from hubot-telegram.
Found the issue, it happens when you are receiving a normal HTTP error instead of a Telegram error. This is most likely related to the wrong auth token, I will update the underlying library.
from hubot-telegram.
Do you mean that I could have copy-pasted my bot's token wrong?
I used this post to guide myself through installation.
from hubot-telegram.
Yes, try and do an npm update
to update the telegrambot dependency. It should now show the HTTP status code of non-Telegram errors. If the status code is 403, it means the auth token is wrong.
from hubot-telegram.
Let me know what error code you receive after doing the update and I will try to assist.
from hubot-telegram.
Of course, sorry, I got busy with work π
I updated telegrambot
as you said, now hubot prints
[Wed Jul 22 2015 13:57:40 GMT-0400 (EDT)] INFO Telegram Adapter Started...
[Wed Jul 22 2015 13:57:41 GMT-0400 (EDT)] ERROR hubot-heroku-alive included, but missing HUBOT_HEROKU_KEEPALIVE_URL. `heroku config:set HUBOT_HEROKU_KEEPALIVE_URL=$(heroku apps:info -s | grep web_url | cut -d= -f2)`
[Wed Jul 22 2015 13:57:41 GMT-0400 (EDT)] INFO hubot-redis-brain: Using default redis on localhost:6379
[Wed Jul 22 2015 13:57:41 GMT-0400 (EDT)] ERROR Error:
at Function.TelegramBot.error (/home/bot/ddbot/node_modules/hubot-telegram/node_modules/telegrambot/lib/telegrambot.js:26:15)
at Request._callback (/home/bot/ddbot/node_modules/hubot-telegram/node_modules/telegrambot/lib/telegrambot.js:47:88)
at Request.self.callback (/home/bot/ddbot/node_modules/hubot-telegram/node_modules/telegrambot/node_modules/request/request.js:198:22)
at Request.emit (events.js:110:17)
at Request.<anonymous> (/home/bot/ddbot/node_modules/hubot-telegram/node_modules/telegrambot/node_modules/request/request.js:1057:14)
at Request.emit (events.js:129:20)
at IncomingMessage.<anonymous> (/home/bot/ddbot/node_modules/hubot-telegram/node_modules/telegrambot/node_modules/request/request.js:1003:12)
at IncomingMessage.emit (events.js:129:20)
at _stream_readable.js:908:16
at process._tickCallback (node.js:355:11)
The ERROR
part loops until I kill it. I can't really see any error codes.
from hubot-telegram.
Is telegrambot on version 0.0.11?
from hubot-telegram.
also, do you run the bot like this:
TELEGRAM_TOKEN=asdb12341414141 bin/hubot -a telegram -n botname
without wrapping the token in <> (stupid question, just checking)
from hubot-telegram.
Yeah, I exported TELEGRAM_TOKEN
variable earlier, it echoes back and hubot shows it on initialisation, so no problems there π
I'm just not familiar with npm
and I am not exactly sure what I'm doing π I finally reinstalled hubot-telegram
to update it dependencies π Now there is a new info in error explanations:
[Wed Jul 22 2015 14:21:32 GMT-0400 (EDT)] ERROR Error: HTTP status 403 returned.
You were right. What should I do?
from hubot-telegram.
That means that your token isn't authenticating properly.
Try hitting this url:
https://api.telegram.org/bot[token]/getUpdates
Replace the [token] part with your token and see if you get a decent response back, if that doesn't work it means the token you exported is not valid.
from hubot-telegram.
I am sorry, turns out :
in my token got replaced by ;
and I didn't notice because of a bad font. All is working properly now. Thanks for your help! π
from hubot-telegram.
I have to more questions though:
- Is there a way to ask bot with @ verylongname by a shorter name, for example @ vln, in a group?
- Can hubot run constantly in the background (without blocking my command line)?
from hubot-telegram.
- you can run it with the hubot alias flag like
./bin/hubot -a telegram -n original_long_name -l short_name
- You can run the hubot like
./bin/hubot -a telegram -n original_name &
. The & will ask Linux to the process in the background.
For a more complete process mangement approach, look at something like forever.js
from npm. It will keep your processes alive forever and start them up if they fail.
from hubot-telegram.
- Alias is accepted and bot prints help with its name replaced by alias, but I can't call bot within Telegram by this alias (with or without @ in front).
- It works, but every time it handles a request it outputs a string. Is there a way to disable logging?
I feel maybe these questions should be in separate issues. However, they aren't really about hubot-telegram (well, maybe aliases problem is about Telegram).
from hubot-telegram.
I will have a look at the alias issue, as for the process problem...you can pipe the output to a log file like so bin/hubot -a telegram -n name > log.file &
from hubot-telegram.
OK, thanks a lot!
from hubot-telegram.
I found it, the issue you are running into with aliases is because of the https://core.telegram.org/bots#privacy-mode
It means that Telegram wont deliver messages unless it is directly send to the Telegram Bot user (when privacy mode is enabled). You can test this theory by running your command like this:
/@short_name help
The /
character also works with privacy mode to indicate that bots should respond to the message. You can fix the problem by turning off privacy mode using their BotFather or prefixing all your instructions to the bot with /
from hubot-telegram.
Got it, thanks! Prefixing with /
works like a charm.
Final question! π Is there an easy way to restrict usage of my bot by other strangers?
from hubot-telegram.
I currently have the same problem, you can probably deal with it in multiple ways
- Use Deep Linking to pass
/start password
to your bot where the password is only known to internal people. Your bot will have to have a custom script that listens for the password and then adds your user to a "safe" list. - Create a custom script that you add first in Hubot, the script will contain a list of chatroom IDs that you can manage via a database/cache/hardcoded...and if the incoming message doesn't belong to a supported chat room (or to a user you previously approved with a password like in step 1) you can block communication.
I wrote a custom "firewall" script for my personal needs, it blocks chats that don't belong to a predefined list of chatrooms.
module.exports = function (robot) {
robot.hear(/(.*)/, function (res) {
if (supportedRooms.indexOf(res.message.room) < 0) {
res.message.done = true // <- stops other listeners from responding
res.reply('you suck...I don't know you!');
}
});
}
from hubot-telegram.
OK, I see. It's not that hard after all, thanks! I think this info about privacy will be interesting to a lot of people β maybe add it to readme or something?
from hubot-telegram.
Will do, thanks
from hubot-telegram.
Related Issues (20)
- Receiving double messages when polling
- ERROR Error: HTTP status 504 returned. HOT 2
- ERROR TypeError: Cannot read property 'message_id' of undefined HOT 11
- bot no receiving messages from supergroup HOT 5
- API fields have been renamed HOT 2
- Remove bot name when using /command@bot_name HOT 1
- Maximum call stack size exceeded HOT 6
- Slow connectivity causes duplicate messages HOT 2
- Newbie request
- error on help command (and workaround) HOT 11
- Expose reply_to_message from message
- Add `hubot-adapter` topic HOT 1
- / commands in supergroups not working HOT 2
- Proxy issues HOT 1
- CoffeeScript 2.x support HOT 2
- Read the response text of a message HOT 1
- Group Chat Slash Command With Mention HOT 1
- Interval Issue HOT 1
- Markdown with Bad Entities
- Error seeking help HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hubot-telegram.