Commit 099fd419 authored by Fanny Abdel's avatar Fanny Abdel
Browse files

Merge branch 'master' of 192.168.1.222:git/relearn

parents d46182e8 2ad0c3c0
import irc.bot
class HelloBot(irc.bot.SingleServerIRCBot):
def __init__(self, channel, nickname, server, port=6667):
irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname)
self.channel = channel
def on_welcome(self, c, e):
print "Bot connected"
c.join(self.channel)
def on_privmsg(self, c, e):
self.on_pubmsg(c, e)
def on_pubmsg(self, c, e):
# print e.target, e.source, e.arguments, e.type
m=e.arguments[0].lower()
b=m.replace('v','b')
c.privmsg(self.channel,b)
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description='BashBot')
parser.add_argument('--host', default="localhost", help='host')
parser.add_argument('--port', type=int, default=6667, help='port')
parser.add_argument('channel', help='channel to join')
parser.add_argument('nickname', help='bot nickname')
args = parser.parse_args()
if not args.channel.startswith("#"):
args.channel = "#"+args.channel
bot = HelloBot(args.channel, args.nickname, args.host, args.port)
bot.start()
......@@ -1057,7 +1057,3 @@
2014-07-11 13:19:34 //poetbot : http.//www.codedrops.net/irc_poetry/?id=poem_11Jul2014105710
2014-07-11 13:27:02 //poetbot : I come to hear you and create something out of it, fellows
2014-07-11 13:30:57 //poetbot : I come to hear you and create something out of it, fellows
2014-07-11 14:54:43 //armansansd : echo
2014-07-11 14:54:43 //SF-2084 : Meanwhile in 2084: Personalize world connection love.
2014-07-11 14:55:33 //armansansd : My message will be recorded encoded in shapes
2014-07-11 14:55:33 //SF-2084 : Meanwhile in 2084: Life it. Life personalize and and try how personalize. As connect people people. Where personalize. Network personalize world love network and personalize and. Personalize it world love and personalize and. Connect it. And connection try future personalize and.
This diff is collapsed.
2014-07-09 16:22:54 //octavia_butler : this service may continue
2014-07-09 16:48:04 //armansansd : who
2014-07-09 17:15:03 //armansansd : test
2014-07-09 17:29:44 //Zigbe : does those changes i made on failsafe save on nomral mode?
2014-07-09 17:29:52 //Zigbe : should I ssh now?
2014-07-09 17:29:59 //automatist : yes
2014-07-09 17:30:08 //automatist : after mount_root
2014-07-09 17:30:11 //automatist : changes are "real"
2014-07-09 17:30:13 //automatist : and then reboot -f
2014-07-09 17:30:20 //automatist : will restart in normal mode, so using the config
2014-07-09 17:30:31 //automatist : is it setup to join the wireless
2014-07-09 18:27:38 //nick : hu ho
2014-07-09 18:27:46 //nick : :-)
2014-07-09 18:48:59 //automatist : hello
2014-07-09 18:55:10 //automatist : hello
2014-07-09 18:56:28 //automatist : hello
2014-07-09 18:56:42 //automatist : hello
2014-07-09 18:59:13 //automatist : foo
2014-07-09 19:00:21 //automatist : hell
2014-07-09 19:24:06 //armansansd : hello monk
2014-07-09 19:25:51 //octavia_butler : monk is writing in the bible directory of my machine
2014-07-10 12:21:35 //Alpha60Agent3 : 00,05Alpha60Agent3 has been activated on #2084ircnotes. Please stay rational.
2014-07-10 12:47:50 //Alpha60Agent2 : 00,05Alpha60Agent2 has been activated on #2084ircnotes. Please stay rational.
2014-07-10 12:50:51 //Alpha60Agent2 : 00,05Alpha60Agent2 has been activated on #2084ircnotes. Please stay rational.
2014-07-10 12:53:59 //Alpha60Agent2 : 00,05Alpha60Agent2 has been activated on #2084ircnotes. Please stay rational.
2014-07-10 12:55:46 //Alpha60Agent2 : 00,05Alpha60Agent2 has been activated on #2084ircnotes. Please stay rational.
2014-07-10 13:00:58 //Alpha60Agent2 : 13,14Alpha60Agent2 has been activated on #2084ircnotes. Please stay rational.
2014-07-10 13:18:00 //Alpha60Agent2 : 13,14Alpha60Agent2 has been activated on #2084ircnotes. Please stay rational.
2014-07-10 13:21:24 //Alpha60Agent2 : 13,14Alpha60Agent2 has been activated on #2084ircnotes. Please stay rational.
2014-07-10 13:23:45 //Alpha60Agent2 : 13,14Alpha60Agent2 has been activated on #2084ircnotes. Please stay rational.
2014-07-11 11:11:24 //philip_k_dick : we organise a botparade
2014-07-11 11:11:32 //philip_k_dick : each bot will be presented separately
2014-07-11 11:11:49 //philip_k_dick : and her appearance will be announced on the relearn channel
......
......@@ -4,10 +4,11 @@ from random import randint
from polar.polar import spiral
class ReportPlotBot(irc.bot.SingleServerIRCBot):
def __init__(self, observechannel, plotchannel, nickname, server, port=6667):
def __init__(self, observechannel, plotchannel, nickname, server, port=6667, plotter = None):
irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname)
self.observechannel = observechannel
self.plotchannel = plotchannel
self.plotter = plotter
def on_welcome(self, c, e):
print "Bot connected"
......@@ -22,36 +23,36 @@ class ReportPlotBot(irc.bot.SingleServerIRCBot):
if e.target == self.observechannel:
#this change the precision of the circle
NbUsers = len(self.channels[e.target].users())
rng=randint(1,6)
#rng=1+(randint(0,100) * .01)
rng=randint(1,7)
angle=360/(NbUsers/rng)
#choose a random position
pX=randint(0,16158)
pY=randint(0,11040)
pX=randint(-24050,24050)
pY=randint(-17975,17975)
#radius = 5000
if e.target == self.observechannel:
msg = e.arguments[0]
#this count the length of a message and draws a circle accordingly
#msg = e.arguments[0]
#count = len(msg)
#size = min(count*100, 3000)
#todo='PA3000,5000;CI{0}'.format(wordcount)+','+str(angle)
#c.privmsg(self.plotchannel,str(todo))
NbWords = len(msg.split())
d=50
for x in range(0,NbWords):
cl='PA'+str(pX)+','+str(pY)+';CI{0}'.format((d*x)+d)+','+str(angle)
print cl
cl=spiral(pX - radius,pY - radius,pX + radius,pY + radius,30,NbWords,angle)
#for x in range(0,NbWords):
# cl='PA'+str(pX)+','+str(pY)+';CI{0}'.format((d*x)+d)+','+str(angle)
# print cl
if self.plotter == None:
c.privmsg(self.plotchannel,str(cl))
else:
self.plotter.write(cl)
posN=(NbWords*d)+20
pos = 'PR{0},{0}'.format(posN)
c.privmsg(self.plotchannel, 'DT*,1;SI0.15,0.2;{0};LB{1}*'.format(pos,e.source.nick))
def on_join(self, c, e):
if e.target == self.observechannel:
p=randint(1,4)
#def on_join(self, c, e):
#if e.target == self.observechannel:
#p=randint(1,4)
#this adds the random pen select on login of new user
c.privmsg(self.plotchannel, 'SP{0}'.format(p))
#c.privmsg(self.plotchannel, 'SP{0}'.format(p))
......
import argparse
from threading import Thread
import chiplotle
from plotbot import PlotBot
from reporter import ReporterPlotBot
parser = argparse.ArgumentParser(description='BashBot')
parser.add_argument('--host', default="localhost", help='host')
parser.add_argument('--port', type=int, default=6667, help='port')
parser.add_argument('observechannel', help='channel to join', default = '#2084')
parser.add_argument('plotchannel', help='channel to join', default = '#frontplotbot')
parser.add_argument('plotnickname', help='bot nickname', default = 'RonaldWeexy')
parser.add_argument('reportnickname', help='bot nickname', default = 'Circle')
def main():
args = parser.parse_args()
plotter = chiplotle.instantiate_plotters()[0]
reporter = ReportPlotBot(args.observechannel, args.plotchannel, args.nickname, args.host, args.port, plotter = plotter)
plot = PlotBot(False, plotter, args.plotchannel, args.nickname, args.host, args.port)
Thread(None, reporter.start)
Thread(None, plot.start)
if __name__ == "__main__":
main()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment