{"action":"created","issue":{"url":"https://api.github.com/repos/schroffl/alfred-teamspeak/issues/3","repository_url":"https://api.github.com/repos/schroffl/alfred-teamspeak","labels_url":"https://api.github.com/repos/schroffl/alfred-teamspeak/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/schroffl/alfred-teamspeak/issues/3/comments","events_url":"https://api.github.com/repos/schroffl/alfred-teamspeak/issues/3/events","html_url":"https://github.com/schroffl/alfred-teamspeak/issues/3","id":162721779,"number":3,"title":"Need Examples when functions was having callbacks","user":{"login":"maissani","id":1372756,"avatar_url":"https://avatars.githubusercontent.com/u/1372756?v=3","gravatar_id":"","url":"https://api.github.com/users/maissani","html_url":"https://github.com/maissani","followers_url":"https://api.github.com/users/maissani/followers","following_url":"https://api.github.com/users/maissani/following{/other_user}","gists_url":"https://api.github.com/users/maissani/gists{/gist_id}","starred_url":"https://api.github.com/users/maissani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maissani/subscriptions","organizations_url":"https://api.github.com/users/maissani/orgs","repos_url":"https://api.github.com/users/maissani/repos","events_url":"https://api.github.com/users/maissani/events{/privacy}","received_events_url":"https://api.github.com/users/maissani/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-06-28T15:55:13Z","updated_at":"2016-06-29T11:01:21Z","closed_at":null,"body":"Hi, \r\nThe afred teamspeak api change, and i am hardly trying to reproduce the same behavior on our app. \r\nCan you provide use some examples \r\n```  \r\nconst bot = new Alfred({\r\n    'name': 'mybotname',\r\n    'host': 'hosturl',\r\n  });\r\n  var clientsInfos = new Array();\r\n  var botLogin = bot.login('username','password');\r\n // I try to use promise but i fail because i do not know how it works \r\n  getConnected = function() {\r\n    return new Promise((resolve, reject) => {\r\n      botLogin.then(() => bot.send('clientlist'))\r\n      .then(res => console.log(data))\r\n      .then(resolve).catch(reject);\r\n    });\r\n  }\r\n  getConnected();\r\n\r\n // Not working on v4 need some help to reproduce with the v4 usages\r\n  bot.login('username','password').then(() => {\r\n    console.log(\"login\")\r\n    bot.send(\"clientlist\", function(err, response, rawResponse){\r\n      console.log(\"login2\")\r\n      for (var tsclient in response) {console.log(\"login3\")\r\n        bot.send(\"sendtextmessage\", {targetmode:1, target:response[tsclient]['clid'], msg:\"Your ip has been stored into our database for statistics\"})\r\n        bot.send(\"clientinfo\",{clid: response[tsclient]['clid']}, function(err, response, rawResponse){\r\n          //console.log(response);\r\n          clientsInfos[response['cid']] = {\r\n            id: response['client_unique_identifier'],\r\n            nickname: response['client_nickname'],\r\n            servergroups: response['client_servergroups'],\r\n            country: response['client_country'],\r\n            ip: response['connection_client_ip']\r\n          }\r\n          console.log(clientsInfos[response['cid']]);\r\n        })\r\n      }\r\n    });\r\n    console.log(clientsInfos);\r\n  }).catch(err => {\r\n  // Encountered an error during the login process\r\n  console.error(err);\r\n  });*/\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/schroffl/alfred-teamspeak/issues/comments/229324808","html_url":"https://github.com/schroffl/alfred-teamspeak/issues/3#issuecomment-229324808","issue_url":"https://api.github.com/repos/schroffl/alfred-teamspeak/issues/3","id":229324808,"user":{"login":"schroffl","id":12176994,"avatar_url":"https://avatars.githubusercontent.com/u/12176994?v=3","gravatar_id":"","url":"https://api.github.com/users/schroffl","html_url":"https://github.com/schroffl","followers_url":"https://api.github.com/users/schroffl/followers","following_url":"https://api.github.com/users/schroffl/following{/other_user}","gists_url":"https://api.github.com/users/schroffl/gists{/gist_id}","starred_url":"https://api.github.com/users/schroffl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schroffl/subscriptions","organizations_url":"https://api.github.com/users/schroffl/orgs","repos_url":"https://api.github.com/users/schroffl/repos","events_url":"https://api.github.com/users/schroffl/events{/privacy}","received_events_url":"https://api.github.com/users/schroffl/received_events","type":"User","site_admin":false},"created_at":"2016-06-29T11:01:21Z","updated_at":"2016-06-29T11:01:21Z","body":"```javascript\r\nconst bot = new Alfred('hostname');\r\n\r\nbot.use(Alfred.User);\r\n\r\nbot.login('username', 'password')\r\n  .then(() => bot.send('servernotifyregister', { 'event': 'textprivate' }))\r\n  .catch(console.error)\r\n\r\nbot.on('textmessage', data => {\r\n  if(data.msg === '!hello') data.user.respond('world');\r\n});\r\n\r\n```"}}
{"actor":{"display_login":"schroffl"}}