forked from LindseyB/XOmBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
78 additions
and
26 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env ruby | ||
|
||
$: << File.dirname(__FILE__) + '/../lib' | ||
|
||
require 'xombot' | ||
require 'xombot/cli' | ||
|
||
XOmBot::CLI.run |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require 'bundler' | ||
Bundler.require | ||
|
||
require 'xombot/plugins/hello' | ||
|
||
module XOmBot | ||
class << self | ||
def load_plugins | ||
end | ||
|
||
def start | ||
bot = Cinch::Bot.new do | ||
configure do |c| | ||
c.server = "irc.freenode.org" | ||
c.port = 6697 | ||
c.ssl.use = true | ||
c.nick = "XOmBot-test" | ||
c.channels = ["#XOmBot"] | ||
c.plugins.plugins = [Hello] | ||
end | ||
end | ||
|
||
bot.start | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'xombot' | ||
require 'optparse' | ||
|
||
module XOmBot | ||
class CLI | ||
BANNER = <<-USAGE | ||
Usage: | ||
Run with the default parameters: | ||
xombot | ||
USAGE | ||
|
||
class << self | ||
def parse_options | ||
@opts = OptionParser.new do |opts| | ||
opts.banner = BANNER.gsub(/^\s{4}/, '') | ||
|
||
opts.separator '' | ||
opts.separator 'Options:' | ||
|
||
opts.on('-h', '--help', 'Display this help') do | ||
puts opts | ||
exit | ||
end | ||
end | ||
|
||
@opts.parse! | ||
end | ||
|
||
def run | ||
XOmBot.start | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class Hello | ||
include Cinch::Plugin | ||
|
||
match "hello" | ||
help "This command says hello." | ||
|
||
def execute(m) | ||
m.reply "Hello, #{m.user.nick}" | ||
end | ||
end |