added config.json for mongo auth config
This commit is contained in:
parent
bfab09ef2d
commit
59350c339f
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
config.json
|
2
Gemfile
2
Gemfile
@ -15,6 +15,6 @@ gem 'prime'
|
|||||||
gem 'pastebinrb'
|
gem 'pastebinrb'
|
||||||
gem 'ascii-image'
|
gem 'ascii-image'
|
||||||
gem 'rmagick'
|
gem 'rmagick'
|
||||||
#gem 'mongo' #lol this one is actually really fucking important js
|
gem 'mongo' #lol this one is actually really fucking important js
|
||||||
gem 'extralite' #sqlitle never wants to instawall
|
gem 'extralite' #sqlitle never wants to instawall
|
||||||
|
|
||||||
|
@ -5,9 +5,13 @@ GEM
|
|||||||
ascii-image (0.1.5)
|
ascii-image (0.1.5)
|
||||||
rainbow (~> 3.0, >= 3.0.0)
|
rainbow (~> 3.0, >= 3.0.0)
|
||||||
rmagick (~> 2.16, >= 2.16.0)
|
rmagick (~> 2.16, >= 2.16.0)
|
||||||
|
bson (4.12.1)
|
||||||
cinch (2.3.4)
|
cinch (2.3.4)
|
||||||
|
extralite (1.2)
|
||||||
fmylife (0.6.0)
|
fmylife (0.6.0)
|
||||||
forwardable (1.3.2)
|
forwardable (1.3.2)
|
||||||
|
mongo (2.15.0)
|
||||||
|
bson (>= 4.8.2, < 5.0.0)
|
||||||
nokogiri (1.11.6-x86_64-linux)
|
nokogiri (1.11.6-x86_64-linux)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
open-uri (0.1.0)
|
open-uri (0.1.0)
|
||||||
@ -29,7 +33,9 @@ DEPENDENCIES
|
|||||||
ansirc
|
ansirc
|
||||||
ascii-image
|
ascii-image
|
||||||
cinch
|
cinch
|
||||||
|
extralite
|
||||||
fmylife
|
fmylife
|
||||||
|
mongo
|
||||||
nokogiri
|
nokogiri
|
||||||
open-uri
|
open-uri
|
||||||
pastebin
|
pastebin
|
||||||
@ -39,4 +45,4 @@ DEPENDENCIES
|
|||||||
shellwords
|
shellwords
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.2.21
|
2.2.25
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
require 'cinch'
|
require 'cinch'
|
||||||
|
require "json"
|
||||||
require 'pastebinrb'
|
require 'pastebinrb'
|
||||||
require_relative "Hooks.rb"
|
require_relative "Hooks.rb"
|
||||||
require_relative "Meta.rb"
|
require_relative "Meta.rb"
|
||||||
@ -76,12 +77,18 @@ module Util #utilities and such
|
|||||||
def initialize
|
def initialize
|
||||||
@@excuses = [];
|
@@excuses = [];
|
||||||
@@success = [];
|
@@success = [];
|
||||||
@@url = "127.0.0.1:27017"
|
config = JSON.parse(
|
||||||
|
File.open("config.json","r") { |f| f.read() }
|
||||||
|
)
|
||||||
|
mUsr = config['username']
|
||||||
|
mPass = config['password']
|
||||||
|
@@url = "mongodb://#{mUsr}:#{mPass}@127.0.0.1:27017
|
||||||
|
"
|
||||||
@@mongos = {};
|
@@mongos = {};
|
||||||
@@mongos[:chans] = Mongo::Client.new([@@url], :database => "chans")
|
@@mongos[:chans] = Mongo::Client.new(@@url, :database => "chans")
|
||||||
@@mongos[:extendobot] = Mongo::Client.new([@@url], :database => "extendobot")
|
@@mongos[:extendobot] = Mongo::Client.new(@@url, :database => "extendobot")
|
||||||
@@mongos[:acl] = Mongo::Client.new([@@url], :database => "acl")
|
@@mongos[:acl] = Mongo::Client.new(@@url, :database => "acl")
|
||||||
@@mongos[:markov] = Mongo::Client.new([@@url], :database => "markov")
|
@@mongos[:markov] = Mongo::Client.new(@@url, :database => "markov")
|
||||||
end
|
end
|
||||||
def getDB(dbn)
|
def getDB(dbn)
|
||||||
db = @@mongos[dbn.to_sym]
|
db = @@mongos[dbn.to_sym]
|
||||||
@ -91,7 +98,7 @@ module Util #utilities and such
|
|||||||
return db
|
return db
|
||||||
else
|
else
|
||||||
#puts "initializing connection to #{dbn}"
|
#puts "initializing connection to #{dbn}"
|
||||||
p @@mongos[dbn.to_sym] = Mongo::Client.new([@@url], :database => dbn)
|
p @@mongos[dbn.to_sym] = Mongo::Client.new(@@url, :database => dbn)
|
||||||
return @@mongos[dbn.to_sym]
|
return @@mongos[dbn.to_sym]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -213,11 +220,10 @@ module Util #utilities and such
|
|||||||
c.server_queue_size = 512
|
c.server_queue_size = 512
|
||||||
c.messages_per_second = 64
|
c.messages_per_second = 64
|
||||||
puts "gotta find thgat nick for #{name} in da game mayne"
|
puts "gotta find thgat nick for #{name} in da game mayne"
|
||||||
q = conf.find({ 'key' => 'nick', 'server' => name })#.to_a[0]["val"]
|
nickname = conf.find({ 'key' => 'nick', 'server' => name }).to_a[0]["val"]
|
||||||
puts "here is a thing: #{q.inspect}"
|
puts "here is a thing: #{nickname}"
|
||||||
exit
|
|
||||||
c.user = "botholejones"
|
c.user = "botholejones"
|
||||||
c.nick
|
c.nick = nickname
|
||||||
c.realname = "O Shid It Dat Bot!"
|
c.realname = "O Shid It Dat Bot!"
|
||||||
passwd = nil
|
passwd = nil
|
||||||
pass = conf.find({ 'key' => 'pass', 'server' => name })
|
pass = conf.find({ 'key' => 'pass', 'server' => name })
|
||||||
|
@ -72,7 +72,7 @@ class Markovian
|
|||||||
end
|
end
|
||||||
|
|
||||||
def markov(m,length=nil,seed=nil)
|
def markov(m,length=nil,seed=nil)
|
||||||
out = start(m,seed,length == nil ? length : length.to_i)
|
out = start(m,seed,length == nil ? length : length.to_i)
|
||||||
puts "markov out:\n\t#{out}"
|
puts "markov out:\n\t#{out}"
|
||||||
m.reply(out)
|
m.reply(out)
|
||||||
|
|
||||||
@ -118,13 +118,13 @@ class Markovian
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def start(m, seed=nil, words=nil)
|
def start(m, seed=nil, words=nil)
|
||||||
db = Util::Util.instance.getCollection("markov","ngrams")
|
db = Util::Util.instance.getCollection("markov","ngrams")
|
||||||
res = ""
|
res = ""
|
||||||
if(words == nil)
|
if(words == nil)
|
||||||
words = (4+rand(24).to_i)
|
words = (4+rand(24).to_i)
|
||||||
end
|
end
|
||||||
words = words > 1024 ? 1024 : words
|
words = words > 256 ? 256 : words
|
||||||
#puts "begin markov chainsaw"
|
#puts "begin markov chainsaw"
|
||||||
#puts "start.count: #{words}, start.seed: #{seed}"
|
#puts "start.count: #{words}, start.seed: #{seed}"
|
||||||
if seed != nil
|
if seed != nil
|
||||||
|
Loading…
Reference in New Issue
Block a user