Skip to content

Look up any user <Feature Request> #41

Description

@BenTheHokie

The ability to pull up any user's profile by simply typing their name in. I have some javascript code that you might be able to use to incorporate into your extension.

Get the "room":

for (var a in turntable) {
    var b = turntable[a];
    if (typeof b !== "object" || b === null) {
        continue
    }
    if (typeof b.setupRoom !== "undefined") {
        room = b;
    }
}

Get the room manager:

for (var a in room) {
    var b = room[a];
    if (typeof b !== "object" || b === null) {
        continue
    }
    if (typeof b.blackswan !== "undefined") {
        var manager = b;
    }
}

Get the websocket for the API. You may be able to use your TTPAPI for this part:

var a = / Preparing message /i;
for (var b in turntable) {
    var c = turntable[b];
    if (typeof c !== "function") {
        continue
    }
    c.toString = Function.prototype.toString;
    if (a.test(c.toString())) {
        ttApi = c;
    }
}

Pull up the profile:

javascript: var userName = prompt('User to search for:');
if (userName != null) {
    ttApi({
        api: 'user.get_id',
        name: userName
    }, function (m) {
        if (m.err) {
            turntable.showAlert('Error: ' + m.err);
        } else {
            manager.callback('profile', m.userid);
        }
    });
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions