-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Channel Changer Plugin #7
Comments
Starting work on this issue. |
I need some assistance. for some reason I can't get anything to match using match /match_regex/ or any of the other forms of that feature in cinch. I even tried making my own cinch project in which I simple copied their demo of that feature and it still isn't working. Could I have something miss configured? could I be missing a prereq. I can't believe that this feature would need any other package since regex is built in. |
Hmm, do you have your code up in a fork somewhere? One thing to make sure is that you're loading the plugin in the |
Ah- I see (looked at your fork) -- you don't need to add the ! at the beginning of the command. Cinch will add that for you. |
Ok thank you. I now have it mostly working. It also defaults to
is equivalent to
Future work
Git?I've updated my branch of the fork. will that be included in the pull request I issued earlier or will I need to request a pull again. |
Cool. As for User Privileges. I think it can just be controlled by an ENV Var at start up, and a command for any privileged user to add another. IRC does have a notion of a 'registered' user -- but that's per-server (eg, on freenode, you can register your nickname). Ideally, we only allow registered nicknames to do anything required by an approved user. I think you would need to learn Freenode's IRC API (a series of messages, usually sent to/received from the ChanServ and NickServ users). For a first pass, a series of hardcoded names should suffice. When updating a branch associated with a pull request, any update is automatically propagated to the PR. Thus, if you intend to submit two separate PR's, you should have two separate branches. I recommend trying to only have one open at a time, because otherwise you'll end up in rebase hell. |
I've got an issue I would like some help with. I'm trying to extend the Cinch::User class to contain something like class Cinch::User
roles = [:channel => ["colwem", "jfredett"]]
def role? role
roles[role].include? self
end
end
#so that I can call
do_role_action if irc.user.role? :role But I'm really at a loss for exactly how to do this. It's a matter of scope and I've never been very good at scope in ruby (I've never been very good at ruby actually). I would like to share my code however I've run into a problem with my understanding of git and github. I've made a branch 'channel_changer' and I would like to push it to github so you can look at it. However I did
But I can't find branch on github. How do I push the branch such that I can get it on github? |
As for the first bit, I would recommend, emphatically, not monkey patching the Cinch::User class. since it's responsibility (representing an IRC user) is highly dissimilar from the responsibility of determine user capabilities. Essentially, the relationship between users and their 'approved' status is that of a "HAS_A", not an "IS_A" -- that is to say, it's not a property, but an association. A user may be associated with a "Role" of being approved. To accomplish this, I would structure it as follows: class UserRole
def self.approved?(username)
ENV["APPROVED_USERS"].include?(username)
end
end This way, you code becomes: do_action if UserRole.approved?(irc.user) (mod API mistakes on my part). We could then naturally extend that class UserRole
def self.if_approved?(user)
yield if approved?(user)
end
end This way, we alter the API to look like: UserRole.if_approved?(user) do
do_action
end Which I think reads a little nicer. This way also avoids any sort of weird scope bugs. As for the git issue, you probably need to specify After that, there is a 'branch' dropdown in the upper lefthand corner of the directory listing, should be able to push that and see where the branch lives. |
Ok jfredett I've added a UserRole class with one class method approved?. I've pushed it with git push origin channel_changer. |
When an approved user sends the command
Percy should join that channel
When an approve user sends the command
Percy should leave, the channel in this case should default to the current channel.
The text was updated successfully, but these errors were encountered: