This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Cinch | |
module Helpers | |
# Checks a user's access in the specified channel. | |
# @param channel [Channel, String] A Channel object or string that is the name of the channel. (i.e. #chat) | |
# @param user [User] A User object | |
# @param ignored_members [Array<String>] An array of modes that this method will ignore | |
# @return [Boolean] Returns True if the user has any channel modes other than the ignored modechars | |
# @author Mark Seymour/Azure <mark.seymour.ns@gmail.com> | |
def check_user(channel, user, ignored_members=["v"]) | |
ignored_members ||= [] # If nil, assign an empty array. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Cinch | |
module Helpers | |
def check_user(channel, user, ignored_members=["v"]) | |
ignored_members ||= [] # If nil, assign an empty array. | |
users = Channel(channel).users # All users from supplied channel | |
modes = @bot.irc.isupport["PREFIX"].keys - ignored_members # | |
modes.any? {|mode| users[user].include?(mode)} | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Cinch | |
module Plugins | |
class HelloBot | |
include Cinch::Plugin | |
set(:plugin_name => "Hello Bot", :help => 'Responds on "!hello"') | |
match "hello" | |
def execute(m) | |
m.reply "Hello #{m.user.nick}, my name is #{@bot.nick}!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @author Mark Seymour (mark.seymour.ns@gmail.com) | |
require 'date' | |
class Person | |
attr_accessor :first_name | |
attr_accessor :last_name | |
attr_accessor :birthday | |
# @param [String] The person's first name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Observations from below: nil gets sent, so that overrides any defaults. | |
Search should be switched over to named params. | |
<@Azure> !tw | |
<@Aiko_> TWITTER: tweet_by_username - params: {:username=>nil, :nth_tweet=>nil} | |
<@Azure> !tw azuretan | |
<@Aiko_> TWITTER: tweet_by_username - params: {:username=>"azuretan", :nth_tweet=>nil} | |
<@Azure> !tw azuretan+10 | |
<@Aiko_> TWITTER: tweet_by_username - params: {:username=>"azuretan", :nth_tweet=>"10"} | |
<@Azure> @ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
mli: | |
My site: http://insomniafanfics.weebly.com | |
Tumblr: http://mylittleinsomnia.tumblr.com | |
Facebook: http://www.facebook.com/profile.php?id=100001428581452 | |
PonySquare: http://ponysquare.com/profile-2220/ | |
Twitter: https://twitter.com/#!/DJINs0mnIAK | |
Skype: legit.sketchy | |
E-mail: insomnia@ponify.me | |
XboxLIVE Gamertag: ThatGuyEcho |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'modules/helpers/table_format' | |
module Plugins | |
module Admin | |
class Handler | |
include Cinch::Plugin | |
set( | |
plugin_name: "admin", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Should really make a note here: | |
# This class currently only accepts arrays of data that has separators, rather than being a two-dimensional array. This will be fixed at some point. | |
# It will also not take a single string, or other types of collections. This will also be fixed at some point (in that case, table headings would have to be revamped to allow key->value pairings. | |
# - Mark | |
# -*- coding: utf-8 -*- | |
require 'active_support/core_ext/object/blank' | |
module Helpers | |
# Formats a supplied array into a list or table. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'singleton' | |
require 'digest/sha2' | |
class Admin | |
include Singleton | |
attr_reader :masks | |
attr_accessor :password | |
def initialize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'obj_ext/string' | |
module Plugins | |
class RemoteAdmin | |
include Cinch::Plugin | |
set help: "Relays certain messages to logged-in admins.", required_options: [:admins] | |
listen_to :notice | |
listen_to :private |