{"action":"created","issue":{"url":"https://api.github.com/repos/goto-bus-stop/ircs/issues/1","labels_url":"https://api.github.com/repos/goto-bus-stop/ircs/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/goto-bus-stop/ircs/issues/1/comments","events_url":"https://api.github.com/repos/goto-bus-stop/ircs/issues/1/events","html_url":"https://github.com/goto-bus-stop/ircs/issues/1","id":53253017,"number":1,"title":"Modes","user":{"login":"goto-bus-stop","id":1006268,"avatar_url":"https://avatars.githubusercontent.com/u/1006268?v=3","gravatar_id":"","url":"https://api.github.com/users/goto-bus-stop","html_url":"https://github.com/goto-bus-stop","followers_url":"https://api.github.com/users/goto-bus-stop/followers","following_url":"https://api.github.com/users/goto-bus-stop/following{/other_user}","gists_url":"https://api.github.com/users/goto-bus-stop/gists{/gist_id}","starred_url":"https://api.github.com/users/goto-bus-stop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goto-bus-stop/subscriptions","organizations_url":"https://api.github.com/users/goto-bus-stop/orgs","repos_url":"https://api.github.com/users/goto-bus-stop/repos","events_url":"https://api.github.com/users/goto-bus-stop/events{/privacy}","received_events_url":"https://api.github.com/users/goto-bus-stop/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-02T13:38:46Z","updated_at":"2015-01-02T13:55:05Z","closed_at":null,"body":"figure out a cool way to do channel + user modes\r\n\r\nAlso want to allow custom modes, probably\r\nMaybe something like\r\n\r\n```javascript\r\nserver.registerChannelMode('o', { needs: 'O' }, Mode({\r\n  '+': (channel, param) => channel.addOp(server.findUser(param))\r\n, '-': (channel, param) => channel.removeOp(server.findUser(param))\r\n}))\r\n\r\n// or…\r\nserver.registerUserMode({\r\n  mode: 'r' // regular\r\n  // check if the user who's sending this message has sufficient permissions\r\n, check: (user) => staffChannel.hasUser(user) && /a[ba]/.test(user.nickname)\r\n  // add mode (+r)\r\n, '+': (targetUser, param) => targetUser.regular = true\r\n  // remove mode (-r)\r\n, '-': (targetUser, param) => targetUser.regular = false\r\n})\r\n```"},"comment":{"url":"https://api.github.com/repos/goto-bus-stop/ircs/issues/comments/68527765","html_url":"https://github.com/goto-bus-stop/ircs/issues/1#issuecomment-68527765","issue_url":"https://api.github.com/repos/goto-bus-stop/ircs/issues/1","id":68527765,"user":{"login":"goto-bus-stop","id":1006268,"avatar_url":"https://avatars.githubusercontent.com/u/1006268?v=3","gravatar_id":"","url":"https://api.github.com/users/goto-bus-stop","html_url":"https://github.com/goto-bus-stop","followers_url":"https://api.github.com/users/goto-bus-stop/followers","following_url":"https://api.github.com/users/goto-bus-stop/following{/other_user}","gists_url":"https://api.github.com/users/goto-bus-stop/gists{/gist_id}","starred_url":"https://api.github.com/users/goto-bus-stop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goto-bus-stop/subscriptions","organizations_url":"https://api.github.com/users/goto-bus-stop/orgs","repos_url":"https://api.github.com/users/goto-bus-stop/repos","events_url":"https://api.github.com/users/goto-bus-stop/events{/privacy}","received_events_url":"https://api.github.com/users/goto-bus-stop/received_events","type":"User","site_admin":false},"created_at":"2015-01-02T13:55:05Z","updated_at":"2015-01-02T13:55:05Z","body":"O - give \"channel creator\" status\r\n```javascript\r\nMode({ mode: 'O'\r\n     , check: () => false // users can't set this\r\n     , '+': (channel, param) => channel.creator = server.findUser(param)\r\n     , '-': (channel, param) => delete channel.creator })\r\n```\r\no - give/take channel operator privilege\r\n```javascript\r\nMode({ mode: 'o'\r\n     , check: (user, channel, param) => channel.hasUser(user) && channel.hasOp(user)\r\n     , '+': (channel, param) => channel.addOp(server.findUser(param))\r\n     , '-': (channel, param) => channel.removeOp(server.findUser(param)) })\r\n```\r\nv - give/take the voice privilege\r\n```javascript\r\nMode({ mode: 'v'\r\n     , check: (user, channel, param) => channel.hasUser(user) && channel.hasOp(user)\r\n     , '+': (channel, param) => channel.voice(server.findUser(param))\r\n     , '-': (channel, param) => channel.devoice(server.findUser(param)) })\r\n```\r\na - toggle the anonymous channel flag\r\n```javascript\r\nMode({ mode: 'a'\r\n     , check: (user, channel, param) => channel.creator === user\r\n     , '+': (channel, param) => channel.anonymize() })\r\n```\r\n\r\nRegister all of the above with `server.registerChannelMode(mode)`. then `channel.addMode(alice, 'v', 'bob')`\r\n\r\n`Mode#mode` 1 char mode\r\n`Mode#check(user, target, param)`\r\n`Mode#+(target, param)`\r\n`Mode#-(target, param)`"}}