Closed BenTheHokie closed 12 years ago
from ttapi import Bot
import re
bot = Bot('xxx', 'xxx', 'xxx')
def pmmed(data):
user = data['senderid']
requested_id = re.search('^/username (.+)$', data['text']).group(1)
def profile(data):
bot.pm('The username of the user is %s' % data['name'], user)
bot.getProfile(requested_id, profile)
bot.on('pmmed', pmmed)
bot.start()
user: /username 4f66952ba3f751581d025a4d
bot: The username of the user is Gilbert19
;)
Now I could also do this with a Twitter Profile or something like:
def profileTwitter(data): bot.pm('The Twitter profile of the user is %s.' % data['twitter'],user) bot.getProfile(requested_id, profileTwitter) etc.
Correct?
I may be asking not exactly in the right place, but suppose I wanted to be able to return the username of any user by using getProfile and then reply in a PM e.g.:
How would I go about doing this?
Thanks and pardon my lack of experience ~ LSK