created a gemfile to start keeping track of used gems, etc
created etc/art which houses all of my ansi art,
finished a basic implementation of Artism.rb, only missing
art.web currently but I will get to that soon
created classes/Meta.rb, which injects some helper methods into
Integer (eg, 10.minutes, 2.kilobytes, etc), because why not?
didn't want to have to use activesupport!
If it wasn't in the last one, I also updated Replace to include
the user prefix for their level of access (e.g. +o = @, +v = +)
2021-05-30 07:12:11 +00:00
require 'cinch'
require 'open-uri'
require 'ansirc'
require 'uri'
require 'pastebin'
require " prime "
require_relative '../classes/Util.rb'
class Artism
include Cinch :: Plugin
include Hooks :: ACLHook
include Util :: PluginHelper
include Util :: PasteMaker
set :prefix , / ^: /
@clist = %w{ art.list }
@@commands [ " art.list " ] = " :art.list [/regex/[i]] - list all the available art to play (it will be a lot lol); optional regex to filter it down (and you can do /regex/i for case insensitivity dawg) " ;
2021-05-30 18:11:54 +00:00
match ( / art \ .list \ s*$ / , method : :artlist )
match ( / art \ .list ( \/ (.+) \/ (i)?) / , method : :artlist )
created a gemfile to start keeping track of used gems, etc
created etc/art which houses all of my ansi art,
finished a basic implementation of Artism.rb, only missing
art.web currently but I will get to that soon
created classes/Meta.rb, which injects some helper methods into
Integer (eg, 10.minutes, 2.kilobytes, etc), because why not?
didn't want to have to use activesupport!
If it wasn't in the last one, I also updated Replace to include
the user prefix for their level of access (e.g. +o = @, +v = +)
2021-05-30 07:12:11 +00:00
@@commands [ " art.play " ] = " :art.play <name> - play a specific file, :art.list can be used to see what is available "
@clist . push " art.play "
2021-05-30 18:11:54 +00:00
match ( / art \ .play (.+) / , method : :play_art )
created a gemfile to start keeping track of used gems, etc
created etc/art which houses all of my ansi art,
finished a basic implementation of Artism.rb, only missing
art.web currently but I will get to that soon
created classes/Meta.rb, which injects some helper methods into
Integer (eg, 10.minutes, 2.kilobytes, etc), because why not?
didn't want to have to use activesupport!
If it wasn't in the last one, I also updated Replace to include
the user prefix for their level of access (e.g. +o = @, +v = +)
2021-05-30 07:12:11 +00:00
@@commands [ " art.random " ] = " art.random - play a random art file, who cares what it might be? "
@clist . push " art.random "
2021-05-30 18:11:54 +00:00
match ( / art \ .random / , method : :artspew )
created a gemfile to start keeping track of used gems, etc
created etc/art which houses all of my ansi art,
finished a basic implementation of Artism.rb, only missing
art.web currently but I will get to that soon
created classes/Meta.rb, which injects some helper methods into
Integer (eg, 10.minutes, 2.kilobytes, etc), because why not?
didn't want to have to use activesupport!
If it wasn't in the last one, I also updated Replace to include
the user prefix for their level of access (e.g. +o = @, +v = +)
2021-05-30 07:12:11 +00:00
timer 30 . minutes , method : :gather_files
#@@commands["art.web"] = "art.web <url> - grab an ANSI file from the internet at <url>, convert it, and play it."
#@clist.push "art.web"
#match /art.web (#{@urirxp})/, method: :arternets
2021-05-30 18:11:54 +00:00
#
def initialize ( * args )
super
@files = [ ]
@dir = " etc/art/ "
@urirxp = URI . regexp %w( http https )
gather_files ( )
end
created a gemfile to start keeping track of used gems, etc
created etc/art which houses all of my ansi art,
finished a basic implementation of Artism.rb, only missing
art.web currently but I will get to that soon
created classes/Meta.rb, which injects some helper methods into
Integer (eg, 10.minutes, 2.kilobytes, etc), because why not?
didn't want to have to use activesupport!
If it wasn't in the last one, I also updated Replace to include
the user prefix for their level of access (e.g. +o = @, +v = +)
2021-05-30 07:12:11 +00:00
def gather_files ( )
2021-05-30 18:11:54 +00:00
puts " GATHERING FILES WE ARE GATHERING FILES! "
created a gemfile to start keeping track of used gems, etc
created etc/art which houses all of my ansi art,
finished a basic implementation of Artism.rb, only missing
art.web currently but I will get to that soon
created classes/Meta.rb, which injects some helper methods into
Integer (eg, 10.minutes, 2.kilobytes, etc), because why not?
didn't want to have to use activesupport!
If it wasn't in the last one, I also updated Replace to include
the user prefix for their level of access (e.g. +o = @, +v = +)
2021-05-30 07:12:11 +00:00
@files = Dir . glob ( " * " , base : @dir )
2021-05-30 09:54:54 +00:00
puts " sexy files #{ @files . length } "
created a gemfile to start keeping track of used gems, etc
created etc/art which houses all of my ansi art,
finished a basic implementation of Artism.rb, only missing
art.web currently but I will get to that soon
created classes/Meta.rb, which injects some helper methods into
Integer (eg, 10.minutes, 2.kilobytes, etc), because why not?
didn't want to have to use activesupport!
If it wasn't in the last one, I also updated Replace to include
the user prefix for their level of access (e.g. +o = @, +v = +)
2021-05-30 07:12:11 +00:00
end
def play_art ( m , art )
response = " "
2021-05-30 18:11:54 +00:00
path = " #{ @dir } #{ art } "
created a gemfile to start keeping track of used gems, etc
created etc/art which houses all of my ansi art,
finished a basic implementation of Artism.rb, only missing
art.web currently but I will get to that soon
created classes/Meta.rb, which injects some helper methods into
Integer (eg, 10.minutes, 2.kilobytes, etc), because why not?
didn't want to have to use activesupport!
If it wasn't in the last one, I also updated Replace to include
the user prefix for their level of access (e.g. +o = @, +v = +)
2021-05-30 07:12:11 +00:00
if ! File . exists? path
exc = Util :: Util . instance . getExcuse ( )
response << " #{ m . user . nick } : #{ exc } ( #{ art } does not appear to EXIST smfh lern2type) "
else
response << " %s %s " % [ Format ( :red , " Now playing: " ) , Format ( :red , :bold , path ) ]
2021-05-30 18:11:54 +00:00
response << File . open ( path ) { | file |
file . read
created a gemfile to start keeping track of used gems, etc
created etc/art which houses all of my ansi art,
finished a basic implementation of Artism.rb, only missing
art.web currently but I will get to that soon
created classes/Meta.rb, which injects some helper methods into
Integer (eg, 10.minutes, 2.kilobytes, etc), because why not?
didn't want to have to use activesupport!
If it wasn't in the last one, I also updated Replace to include
the user prefix for their level of access (e.g. +o = @, +v = +)
2021-05-30 07:12:11 +00:00
}
end
m . reply response
end
2021-05-30 18:11:54 +00:00
def artlist ( m , * args )
regex , target , cs = args
created a gemfile to start keeping track of used gems, etc
created etc/art which houses all of my ansi art,
finished a basic implementation of Artism.rb, only missing
art.web currently but I will get to that soon
created classes/Meta.rb, which injects some helper methods into
Integer (eg, 10.minutes, 2.kilobytes, etc), because why not?
didn't want to have to use activesupport!
If it wasn't in the last one, I also updated Replace to include
the user prefix for their level of access (e.g. +o = @, +v = +)
2021-05-30 07:12:11 +00:00
response = " #{ m . user . nick } : "
2021-05-30 18:11:54 +00:00
puts " I GRAB MUH NUT IN DA ART LIST "
3 . times do puts " !!!!!!!!!!!!!!!!!! " end
puts " args: #{ args } "
puts " regex: #{ regex } , target: #{ target } . cs: #{ cs } "
created a gemfile to start keeping track of used gems, etc
created etc/art which houses all of my ansi art,
finished a basic implementation of Artism.rb, only missing
art.web currently but I will get to that soon
created classes/Meta.rb, which injects some helper methods into
Integer (eg, 10.minutes, 2.kilobytes, etc), because why not?
didn't want to have to use activesupport!
If it wasn't in the last one, I also updated Replace to include
the user prefix for their level of access (e.g. +o = @, +v = +)
2021-05-30 07:12:11 +00:00
list = [ ]
if ( regex . nil? ) #no regex provided loil
2021-05-30 18:11:54 +00:00
puts " ig dey want all da smoke "
created a gemfile to start keeping track of used gems, etc
created etc/art which houses all of my ansi art,
finished a basic implementation of Artism.rb, only missing
art.web currently but I will get to that soon
created classes/Meta.rb, which injects some helper methods into
Integer (eg, 10.minutes, 2.kilobytes, etc), because why not?
didn't want to have to use activesupport!
If it wasn't in the last one, I also updated Replace to include
the user prefix for their level of access (e.g. +o = @, +v = +)
2021-05-30 07:12:11 +00:00
list = @files #just get em ALL TOGETHER
else #oh we have a regex i see
sluice = cs . nil? ? / #{ target } / : / #{ target } /i
2021-05-30 18:11:54 +00:00
puts " sluice = #{ sluice } "
list = @files . select { | file | file . match ( sluice ) }
puts " ok list length = #{ list . length } "
created a gemfile to start keeping track of used gems, etc
created etc/art which houses all of my ansi art,
finished a basic implementation of Artism.rb, only missing
art.web currently but I will get to that soon
created classes/Meta.rb, which injects some helper methods into
Integer (eg, 10.minutes, 2.kilobytes, etc), because why not?
didn't want to have to use activesupport!
If it wasn't in the last one, I also updated Replace to include
the user prefix for their level of access (e.g. +o = @, +v = +)
2021-05-30 07:12:11 +00:00
end
if ( list . length > 20 )
2021-05-30 18:11:54 +00:00
puts " building pastebin thingy... "
title = " ANSI Art List ( #{ regex } ) "
created a gemfile to start keeping track of used gems, etc
created etc/art which houses all of my ansi art,
finished a basic implementation of Artism.rb, only missing
art.web currently but I will get to that soon
created classes/Meta.rb, which injects some helper methods into
Integer (eg, 10.minutes, 2.kilobytes, etc), because why not?
didn't want to have to use activesupport!
If it wasn't in the last one, I also updated Replace to include
the user prefix for their level of access (e.g. +o = @, +v = +)
2021-05-30 07:12:11 +00:00
factors = Prime . prime_division ( list . length )
2021-05-30 18:11:54 +00:00
count , power = factors . detect { | f | f [ 1 ] == 1 && f [ 0 ] > 2 }
puts power
created a gemfile to start keeping track of used gems, etc
created etc/art which houses all of my ansi art,
finished a basic implementation of Artism.rb, only missing
art.web currently but I will get to that soon
created classes/Meta.rb, which injects some helper methods into
Integer (eg, 10.minutes, 2.kilobytes, etc), because why not?
didn't want to have to use activesupport!
If it wasn't in the last one, I also updated Replace to include
the user prefix for their level of access (e.g. +o = @, +v = +)
2021-05-30 07:12:11 +00:00
count = 5 if count > 7
chunks = list . each_slice ( count ) . to_a
2021-05-30 18:11:54 +00:00
puts " chunks: #{ chunks } "
code = chunks . map { | chunk |
chunk . join ( " " )
} . join ( " \n " )
created a gemfile to start keeping track of used gems, etc
created etc/art which houses all of my ansi art,
finished a basic implementation of Artism.rb, only missing
art.web currently but I will get to that soon
created classes/Meta.rb, which injects some helper methods into
Integer (eg, 10.minutes, 2.kilobytes, etc), because why not?
didn't want to have to use activesupport!
If it wasn't in the last one, I also updated Replace to include
the user prefix for their level of access (e.g. +o = @, +v = +)
2021-05-30 07:12:11 +00:00
puts " gonna paste this list; info first "
puts " title: #{ title } "
puts " list length: #{ list . length } "
puts " factors: #{ factors . inspect } "
puts " ultimate count: #{ count } "
puts " chunks: #{ chunks . inspect } "
puts " && code to paste: #{ code } "
response << " #{ list . length } results were found; please visit: "
2021-05-30 18:11:54 +00:00
begin
response << " \n " << paste ( {
title : title ,
post : code
} ) << " to see the full list "
rescue Exception = > ex
response << " SOMETHING MESSED UP: #{ ex } "
end
#gonna have to experiment first lol
created a gemfile to start keeping track of used gems, etc
created etc/art which houses all of my ansi art,
finished a basic implementation of Artism.rb, only missing
art.web currently but I will get to that soon
created classes/Meta.rb, which injects some helper methods into
Integer (eg, 10.minutes, 2.kilobytes, etc), because why not?
didn't want to have to use activesupport!
If it wasn't in the last one, I also updated Replace to include
the user prefix for their level of access (e.g. +o = @, +v = +)
2021-05-30 07:12:11 +00:00
else
puts " less than 20 results found yo: #{ list . length } "
response << " here are the #{ list . length } result(s) found. \n " << list . join ( " , " )
end
puts " ultimate response: #{ response } "
#m.reply response
end
2021-05-30 18:11:54 +00:00
def artspew ( m , cmd )
created a gemfile to start keeping track of used gems, etc
created etc/art which houses all of my ansi art,
finished a basic implementation of Artism.rb, only missing
art.web currently but I will get to that soon
created classes/Meta.rb, which injects some helper methods into
Integer (eg, 10.minutes, 2.kilobytes, etc), because why not?
didn't want to have to use activesupport!
If it wasn't in the last one, I also updated Replace to include
the user prefix for their level of access (e.g. +o = @, +v = +)
2021-05-30 07:12:11 +00:00
play_art ( m , @files . sample )
end
def arternets ( m , url )
#response = ""
end
end