yukuku / telebot

Telegram Bot starter kit. Very easy to install with Google App Engine.
Apache License 2.0
689 stars 236 forks source link

Feature: External csv file with custom responses? #16

Closed SDKAAA closed 8 years ago

SDKAAA commented 9 years ago

Would it be possible to configure an external csv file with 2 values on each line: First value is the text the bot should search in user message second value is the response of the bot. This will make it easy to configure the responses on the fly. is such option possible? And would we be able to edit the file in google apps or we need to edit it offline and then use the gapps sdk to upload the app again?

ADTC commented 9 years ago

Anything is possible in Python (well, almost).

Telebot is a starter kit to get you started in hosting a bot in GApps. It's up to you where you want to go from there once you have started. Just write the code and implement what you need!

You need to edit offline and upload (deploy) via SDK. If you want the bot to store/create/edit data, you can use cloude storage (GApps Cloud Storage Buckets) or cloud database (GApps Cloud SQL (MySQL)). Both are paid but but has a free trial. The bot will not be able to create or edit files in GApps file system itself as the file system is read-only.

SDKAAA commented 9 years ago

Thank you :) I managed to run and deploy the starter kit from Ubuntu :) I will now try to connect and read from Google sheet using this: https://github.com/burnash/gspread This way i can update the google sheet and the automated bot responses will be drawn from it . i hope it works. Any snippets on how to send a sticker?

ADTC commented 9 years ago

Oh that's a brilliant idea! But I worry it might be dead slow to use the Google Sheets as a fake database. Good luck! I'd love to hear from you how it's going.

Send a sticker message to your bot and have your bot record the sticker object (or its values)*. Then have the bot send a reply to you with the sticker object (or a new sticker object made from the values).

* Console output from Python code will appear in Google App Engine "Logs" feature. Just look for it.

Once you have that working, you can use that knowledge to build what you're trying to do. BTW, it's all JSON basically.

srazi commented 9 years ago

@ADTC: Sorry for off topic Do you have an estimate of using a real world robot and free plan of Google App Engine? I mean maybe our robot that has some commands for users and send a couple of messages every day to all users can manage thousands users with free plan of Google App Engine?

idreamsi commented 9 years ago

@SDKAAA Hi, I have a problem How can I save my data on Google Docs spreadsheet ? I am getting the following error : ImportError: No module named oauth2client.client

SDKAAA commented 9 years ago

@idreamsi I have not yet applied it but it is mostly available on https://github.com/burnash/gspread Will let you know when i work on it, been busy lately with other priorities :(

SDKAAA commented 9 years ago

Thank you @ADTC !

idreamsi commented 9 years ago

@SDKAAA Thanks.

ADTC commented 9 years ago

@srazi I wouldn't know. Google it? Or just do some stress tests. @SDKAAA You're welcome :smile: