All pastes #71322 Raw Edit

Stuff

public text v1 · immutable
#71322 ·published 2006-06-25 16:38 UTC
rendered paste body
import commands
import os
import random
import kibot.BaseModule


class art(kibot.BaseModule.BaseModule):
        _ascii_cperm = 1
        prefix = "/home/norc/art/"
        def ascii(self, cmd):
                """streams random asciiart
                in a query to [nick]"""

                cmd.msg("starting now")
                self.convertcommand = "image2ascii -geometry 80x24 %s%s" % (self.prefix, self.findfile())
                self.artlist = commands.getoutput(self.convertcommand).split('\n')

                for i in range(len(self.artlist)):
                        cmd.msg("%s" % self.artlist[i])

        def findfile(self):
                cmd.msg("getting random file")
                self.files = os.listdir(self.prefix)
                return(random.choice(self.files))