opensourcehacker / sevabot

A Skype bot supporting integration with external services
http://sevabot-skype-bot.readthedocs.org/
565 stars 121 forks source link

UserID Parameter #31

Closed Aegil closed 11 years ago

Aegil commented 11 years ago

Hey, is it possible for sevabot to pass the userid of the person running the command. So for example if paul or ryan ran a command it would pass their skype id to the script so we can use it as a basic level of authentication in the script as well as allowing the scripts to store data user specifically. I can see in the debug output that the information is received by the sevabot process but not sure if this is implemented currently as an option.

wmzaru commented 11 years ago

Also interested in how to display the Chat Skype id and name? For example: Skype: tom34 Name: Korbin Korbin says !Bot Bot says: Hi * Korbin * your skype * tom34 *

miohtama commented 11 years ago

Let's think a protocol for this. There is no reason why it shouldn't do it. Would environment variables be good?

SKYPE_SENDER_USERNAME SKYPE_SENDER_NAME

etc.

This way it would not mess with command line.

miohtama commented 11 years ago

Please think anything for you for a wishlist.

Then let's implement a simple example. We can extend "sad" example.

Aegil commented 11 years ago

Environmental variables would be perfect for what I need. Which API calls / api are you using and I could look through the docs to see if there is anything else that would be valuable? I think the above you suggested are perfect currently.

miohtama commented 11 years ago

First you need to make this call to extract necessary data from Skype4Py API:

https://github.com/opensourcehacker/sevabot/blob/master/sevabot/bot/bot.py#L110

https://github.com/opensourcehacker/sevabot/blob/master/sevabot/bot/modules.py#L56

I think if there are several "extras" it's the best to pass them as a dictionary argument.

Then you pass them forward in Popen():

https://github.com/opensourcehacker/sevabot/blob/master/sevabot/bot/modules.py#L76

like here:

http://stackoverflow.com/a/4453495/315168

miohtama commented 11 years ago

Implemented in dev branch https://github.com/opensourcehacker/sevabot/blob/dev/modules/sad.py