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'
2021-08-24 08:32:21 +00:00
require 'net/http'
#require 'pastebinrb'
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 " prime "
require_relative '../classes/Util.rb'
class Artism
2021-08-24 08:32:21 +00:00
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) " ;
match ( / art \ .list \ s*$ / , method : :artlist )
match ( / art \ .list ( \/ (.+) \/ (i)?) / , method : :artlist )
@@commands [ " art.play " ] = " :art.play <name> - play a specific file, :art.list can be used to see what is available "
@clist . push " art.play "
match ( / art \ .play (.+) / , method : :play_art )
@@commands [ " art.random " ] = " art.random - play a random art file, who cares what it might be? "
@clist . push " art.random "
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
2021-08-24 08:32:21 +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
2021-08-24 08:32:21 +00:00
def initialize ( * args )
super
2021-05-30 18:11:54 +00:00
2021-08-24 08:32:21 +00:00
@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
2021-08-24 08:32:21 +00:00
def gather_files ( )
puts " GATHERING FILES WE ARE GATHERING FILES! "
@files = Dir . glob ( " * " , base : @dir )
puts " sexy files #{ @files . length } "
end
def play_art ( m , art )
response = " "
path = " #{ @dir } #{ art } "
exc = Util :: Util . instance . getExcuse ( )
if ! File . exists? path
response << " #{ m . user . nick } : #{ exc } ( #{ art } does not appear to EXIST smfh lern2type) "
else
begin
response << " %s %s \n " % [ Format ( :red , " Now playing: " ) , Format ( :red , :bold , path ) ]
response << File . open ( path ) { | file |
file . read
}
rescue = > e
response = " #{ m . user . nick } : #{ exc } \n (THERE WAS A FUCKIN ERROR OR SOME SHIT IDK: #{ e } ) "
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
end
2021-08-24 08:32:21 +00:00
m . reply response
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
2021-08-24 08:32:21 +00:00
def artlist ( m , * args )
regex , target , cs = args
response = " #{ m . user . nick } : "
list = [ ]
link = " "
if ( regex . nil? ) #no regex provided loil
list = @files #just get em ALL TOGETHER
else #oh we have a regex i see
sluice = cs . nil? ? / #{ target } / : / #{ target } /i
puts " THE FUCKIUNG SLUICE IS #{ sluice } "
list = @files . select { | file | puts file ; file . encode ( 'UTF-8' ) . match ( sluice ) }
end
if ( list . length > 20 ) #TOO MANY FSCKING FILES BRO
puts " building pastebin thingy... "
title = " ANSI Art List "
title << " ( #{ regex } ) " if ! regex . nil?
2021-06-01 16:22:09 +00:00
2021-08-24 08:32:21 +00:00
factors = Prime . prime_division ( list . length )
count , power = factors . detect { | f | f [ 1 ] == 1 && f [ 0 ] > 2 }
puts power
count = 5 if count > 7
chunks = list . each_slice ( count ) . to_a
puts " chunks: #{ chunks } "
code = chunks . map { | chunk |
chunk . join ( " " )
} . join ( " \n " )
2021-06-01 16:22:09 +00:00
2021-09-09 09:56:31 +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 } "
begin
link = paste ( code , title )
if link . nil?
throw new Exception ( " SHIT DIDN'T WORK SOZ " )
else
response << " #{ list . length } results were found; please visit "
response << link << " to see the full list " #build output, use link, ACAB
end
rescue Exception = > ex
2021-08-24 08:32:21 +00:00
response << Util :: Util . instance . getExcuse ( )
response << " (SOMETHING FUCKED UP, DEAL WITH IT SORRY) " # told u ACAB, js
end
else
response << " here are the #{ list . length } result(s) found. \n " << list . join ( " , " )
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
2021-08-24 08:32:21 +00:00
m . reply response # tell dat nurga what u got my dude
end
def artspew ( m )
play_art ( m , @files . sample )
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
2021-08-24 08:32:21 +00:00
def arternets ( m , url )
#response = ""
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
end