Testing and Feedback for Telegram Skill

How to install telegram-skill

  • Install telegram-skill by …

  • telegram-skill connects to your telegram-bot …

    • This skill connects to a telegram-bot you created. You need at least an API-Token, your MyCroft Device Name (the name you gave your device in home.mycroft.ai) and your ChatID.
  • Instructions:
    You need to create a telegram bot (via BotFather) and save the Bot Token, your ChatID (you may leave this blank and write to your bot after you put in Token and DeviceName, it will give you your ChatID) and your MyCroft Device name on home.mycroft.ai under skill settings.
    After this restart your MyCroft Unit
    You can now commmunicate with your MyCroft Unit via this bot.

How to test telegram-skill

  • Configure the Skill Settings in home.mycroft.ai (you may configure to mute audio for telegram responses. Only works with alsaaudio)
  • Write your bot, mycroft should answear you via your telegram-bot

Where feedback on telegram-skill should be directed at

Any feedback is welcome here or via [Mycroft Chat] → @luke (https://chat.mycroft.ai).

2 Likes

@Luke,
This looks amazing. I am definitely going to give it a try this weekend. A couple questions…

  1. Have you attempted to install the skill with MSM?
  2. Given the chat bot uses telegram, can the bot be accessed remotely? “I forgot to turn off the lights…ok, I have turned the lights off for you”
1 Like

@Luke,
I attempted to install via msm and via the home.mycroft.ai and both are failing for some reason. I am actually thinking it could be an msm issue and not your repo as I believe msm actually just runs the same command when you “download custom skill”.
@KathyReid, do you know if there has been any changes to msm in the past 24 hours. I am acutally unable to perform even an “msm update” without it failing. I will attempt a reboot and update.

log file is showing this

22:19:24.985 - mycroft.skills.core:wrapper:650 - ERROR - An error occurred while processing a request in Skill Installer Skill
Traceback (most recent call last):
File “/opt/venvs/mycroft-core/lib/python3.4/site-packages/mycroft/skills/core.py”, line 641, in wrapper
handler(message)
File “/opt/mycroft/skills/skill-installer/init.py”, line 74, in install_custom
self.msm.install(link)
File “/opt/venvs/mycroft-core/lib/python3.4/site-packages/msm/mycroft_skills_manager.py”, line 52, in install
self.find_skill(param, author).install()
File “/opt/venvs/mycroft-core/lib/python3.4/site-packages/msm/mycroft_skills_manager.py”, line 164, in find_skill
for skill in self.list():
File “/opt/venvs/mycroft-core/lib/python3.4/site-packages/msm/mycroft_skills_manager.py”, line 148, in list
skill.id: skill for skill in remote_skill_list
File “/opt/venvs/mycroft-core/lib/python3.4/site-packages/msm/mycroft_skills_manager.py”, line 148, in
skill.id: skill for skill in remote_skill_list
File “/opt/venvs/mycroft-core/lib/python3.4/site-packages/msm/mycroft_skills_manager.py”, line 141, in
SkillEntry(
File “/opt/venvs/mycroft-core/lib/python3.4/site-packages/msm/skill_repo.py”, line 74, in get_skill_data
url = module.split('url = ')[1].strip()
IndexError: list index out of range
22:19:24.991 - SKILLS - DEBUG - {“type”: “speak”, “data”: {“expect_response”: false, “utterance”: “An error occurred while processing a request in Skill Installer Skill”}, “context”: {}}

Yes the bot can be used from anywhere. that is why the skill needs the unique ChatID in the settings as a layer of security.

So I have the skill installed, have entered the data in the skill entry on home.mycroft.ai and rebooted the unit. At this point the only response my bot returns is the chat id. Not sure how to get past this point.
Once I get it responding I will have a report on installation and some other ideas.

You need to put your ChatID in the settings at home.mycroft.ai under 1. User.

I did have the I’d entered but still didn’t work. I deleted it and re entered it then performed a reboot. Now it is working as expected. Thanks, I will put together my experience once I have an opportunity to compile my notes.

Great thank you very much!

No recent changes to msm - are you running it in the virtual environment - .venv?

Yes, The problem seems to have corrected itself after a reboot.
Thanks for the support.

1 Like

@Luke, Thought I would give you some feedback now that I have had an opportunity to play with the skill a bit. First off, I must say this is pretty awesome. I love having the ability to command mycroft from anywhere, this has opened some ideas for me on skills.

  1. on home.mycroft.ai the “mute” checkbox should say “answer” not “answear”
  2. i am completely new to Telegram so getting through the installation, configuration, and bot setup was a bit of a challenge (and I am fairly technical) I think some direction on this procedure would be helpful to ease the installation of the skill. As an example the home.mycroft.ai requests “user” as an option this was not clear to me if this was me or mycroft’s Telegram user name. Also the default installation of telegram does not assign a user name. I had to do this after the installation.
  3. I think it would be great if you announced when the skill was loaded. This way I would receive a message when mycroft reboots.
  4. I have noticed that even though I have mute selected in the web gui, mycroft will begin to speak before the muting takes place, only a fraction of a second but still audible.
  5. would be kind of cute if there was a random emoji response :yum: you send an emoji to mycroft and mycroft responds with a random one back.

Anyway, thanks for pulling this together It definitely high on the cool factor for me!

Thanks for your feedback, i will try to implement all of your suggestions in near future

1 Like

@pcwii:

  1. THANKS i fixed the typo
  2. I updated the README on GitHub, added some lines in home.mycroft.ai in the description and renamed the labels. You will find a HowTo in the GitHub README, i hope this clears things up a bit :slight_smile:
  3. Great idea, you will know get a welcome message (off course please get the new version from GitHub first)
  4. is this happening all the time or only for the first message after you restarted your device?
  5. i looked into this, would be fairly simple but it would add a dependency, but i will look into this again in some time, as it would be a cool easter egg :wink:

Thank you very much for testing this!

regards

1 Like

@Luke:
Not sure if this is an easy request or not but there are some mycroft.ai questions that return multiple results that the Telegram Skill does not capture.
example: from the CLI of mycroft:
Q: “tell me about the movie avatar”
R: “I’m checking Wikipedia for movie avatar”
R:"Avatar, is a 2009 American epic…

example: from the Telegram Skill:
Q: “tell me about the movie avatar”
R: “I’m checking Wikipedia for movie avatar”

at this the telegram skill does not intercept the final result that is obtained by Wikipedia. The final Response is executed from the mycroft unit just not intercepted by the Telegram skill.
Love the skill very helpful for testing as well when I don’t have putty available.

Yes, i know this is the biggest issue i am facing at the moment. I don’t got much time to look into this because of a project at work, but after it i will try to make this work.

I would love if a skill was able to send something to the messagebus with a “Tag” (like “telegram-response”) and every response in the messagebus triggered by this request would automatically get the same Tag. Would make this issue disappear in no time :wink:

1 Like

I have my Kodi setup with a cinemavision add-on and one of features I wanted was to have it automatically set the room ambiance before starting the movie. To do this I created a Mycroft skill that responds to a non verbal command. To execute the ambiance mode I just send kodisetambiance as a single word to the message bus. It then mutes Mycroft. Sets my lighting and I am good to go. Not sure if you could do something like this to get the results you need.

That may help me a lot, muting was painful to achieve for me.

Would you point me to the code that i make a look if i can adapt this for the Telegram skill?

Luke,
If you look here it might give you an idea or two. I used the words “PleaseBeSilent” and “YouCanSpeakNow” to issue unspeakable commands to a mycroft “mute-skill” this appears to work and the trigger words since they are being passed through the messagebus could be any unspeakable string so as to avoid spoken triggers of the same intents. There may be other ways to do this but it worked for me.
You will find the mute skill here…


and you will find my “Cinemavision” actions with python code here…

Hope this helps

Some additional feedback. I Can’t seem to get the skill installed successfully.
I’m attempting to install the skill on my Mark 1

For the Dependency: python-telegram-bot
I ssh’d into my Mark 1 and issued the command mycroft-pip install python-telegram-bot
The install error-ed out with the below message:

    creating build/temp.linux-armv7l-3.4
    creating build/temp.linux-armv7l-3.4/c
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.4m -I/opt/venvs/mycroft-core/include/python3.4m -c c/_cffi_backend.c -o build/temp.linux-armv7l-3.4/c/_cffi_backend.o
    c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
     #include <ffi.h>
                     ^
    compilation terminated.
    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

I’m probably installing the dependency wrong, so any pointers would be great!

I also attempted to install the skill, (msm install https://github.com/luke5sky/telegram-skill) but it failed with the below error. I’m assuming this is because I don’t have the dependency installed. Looks like very similar issues.

    creating build/temp.linux-armv7l-3.4
    creating build/temp.linux-armv7l-3.4/c
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.4m -I/opt/venvs/mycroft-core/include/python3.4m -c c/_cffi_backend.c -o build/temp.linux-armv7l-3.4/c/_cffi_backend.o
    c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
     #include <ffi.h>
                     ^
    compilation terminated.
    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
    
    ----------------------------------------

  Failed building wheel for cryptography
  Failed cleaning build dir for cryptography
  Failed building wheel for cffi
Command "/opt/venvs/mycroft-core/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-8c3v26be/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-3x0ygzbe/install-record.txt --single-version-externally-managed --compile --install-headers /opt/venvs/mycroft-core/include/site/python3.4/cffi" failed with error code 1 in /tmp/pip-install-8c3v26be/cffi/

Looking forward to getting this setup, any help is appreciated!
I was able to get the telegram bot setup :slight_smile:

@Luke,
Noticed my telegram skill is no longer responding to requests. I still receive the notification when Mycroft first loads but other than that the skill is silent. Any ideas for troubleshooting?