User Name
Password

Go Back   Planetarion Forums > Planetarion Related Forums > Planetarion Discussions

Reply
Thread Tools Display Modes
Unread 26 Dec 2008, 22:03   #1
morrow
Registered User
 
Join Date: Aug 2008
Posts: 25
morrow is just really nicemorrow is just really nicemorrow is just really nicemorrow is just really nicemorrow is just really nice
Isaac - A Cheap Galaxy Bot

[ Edit: Latest Version and Info -->
htt p://cheleb.n et/wordpress/index.php/isaac-pa-galaxy-bot (mind the space) ]

Hej,

I was fed up with the lack of standalone and simple solutions for a galaxy bot that would take a incoming line pasted in the galaxy channel and relay it to the appropriate defence channel / bot.

While running the Munin monster is clearly overkill and I wanted independence of mIRC / irssi, I wrote a small python bot that does just that: Isaac.

What it does:
1) Relay defcalls pasted in chan to the appropriate defchan / defbot

What you need:
1) Python >= 2.5.2 (lower might worrk, but that's what I run)
2) python-irclib (http:/ /pyt hon-irclib.so urceforge.net/)

Where you get it:
1) http:/ /ww w.chel eb.net/pa/isa ac/isaac-r01.py

* Note: Remove the spaces from the URLs; Forum wouldnt let me post them :/

What you need to configure:
1) Nick, PNick, PPass of the Bot (bottom of file)
2) Planet -> Defchan Mapping (Line 88)
3) Admin PNick (Line 111)

Usage:
1) Fire the bot, be the admin (and +x'ed) and invite the bot to your galchan
2) .die (as admin) to kill the bot
3) .disconnect (as admin) to force reconnect
4) Paste Galaxy Status lines IN CHANNEL

Feel free to comment, suggest, whatnot.

Merry Christmas!

- morrow
__________________
Denial - Evolution

Last edited by morrow; 30 Dec 2008 at 22:41.
morrow is offline   Reply With Quote
Unread 26 Dec 2008, 22:36   #2
Gabriel
Gabba gabba hey hey
 
Join Date: Aug 2008
Posts: 212
Gabriel has a spectacular aura aboutGabriel has a spectacular aura aboutGabriel has a spectacular aura about
Re: Isaac - A Cheap Galaxy Bot

Not many folks have the ability to run a python based bot which is why the mirc bots are so prevalent. Otherwise I would have released my perl bot by now, which is more dependant friendly. Also doesn't the channels and coords mean that the bot needs restarting when updated? Maybe make them read and store from a text file? With accessor methods for them? Add/rem/modify channels based on coords. Also it's fairly trivial to make it understand the lines if pasted in pm to the bot rather than just the gal channel but that's not so important.
Gabriel is offline   Reply With Quote
Unread 26 Dec 2008, 22:46   #3
lokken
BlueTuba
 
lokken's Avatar
 
Join Date: Aug 2000
Posts: 6,339
lokken has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.lokken has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.lokken has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.lokken has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.lokken has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.lokken has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.lokken has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.lokken has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.lokken has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.lokken has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.lokken has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.
Re: Isaac - A Cheap Galaxy Bot

I have no idea what you've done exactly but I know nothing of code; good work on doing something useful none the less
__________________
"Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life."
lokken is offline   Reply With Quote
Unread 26 Dec 2008, 22:47   #4
Jasonw
Registered User
 
Join Date: Aug 2008
Posts: 1
Jasonw is an unknown quantity at this point
Re: Isaac - A Cheap Galaxy Bot

For simple a simple reporting feature, I've just gone to running the trigger.pl script in irssi. is simple enough to use. Been looking at a couple folks bots trying to work out eff and cost functions.

Gabriel, if you'd be willing to share, i'd be interested in looking at yours for ideas if you didn't mind.
Jasonw is offline   Reply With Quote
Unread 26 Dec 2008, 22:48   #5
Banned
Banned
 
Banned's Avatar
 
Join Date: Jul 2003
Location: ******
Posts: 2,326
Banned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so little
Re: Isaac - A Cheap Galaxy Bot

Morrow: good on you. It's cool to see more bots being shared I like the idea of a lightweight bot for people who only need a little bit. Have you thought about writing up a guide for how to run this on Windows?

Quote:
Originally Posted by Gabriel View Post
Not many folks have the ability to run a
python based bot which is why the mirc bots are so prevalent.
You're right, not everyone does.

Quote:
Otherwise I would have released my perl bot by now, which is more dependant friendly.
Yeah, you're a real saint.
Banned is offline   Reply With Quote
Unread 27 Dec 2008, 20:05   #6
ellonweb
Registered User
 
Join Date: Nov 2008
Posts: 401
ellonweb has a brilliant futureellonweb has a brilliant futureellonweb has a brilliant futureellonweb has a brilliant futureellonweb has a brilliant futureellonweb has a brilliant futureellonweb has a brilliant futureellonweb has a brilliant futureellonweb has a brilliant futureellonweb has a brilliant futureellonweb has a brilliant future
Re: Isaac - A Cheap Galaxy Bot

Quote:
Originally Posted by Gabriel View Post
Not many folks have the ability to run a python based bot
Python comes as standard on nix and Mac distributions afaik, and for windows it's a simple install

morrow: as way of improvement, I'd suggest a simple system of updating the defence channel info at runtime, and storing it in either a text file or DB (SQLite for example). If you need help with this you know where to find me
ellonweb is offline   Reply With Quote
Unread 27 Dec 2008, 23:07   #7
Phil^
Insomniac
 
Phil^'s Avatar
 
Join Date: May 2003
Posts: 3,583
Phil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus would
Re: Isaac - A Cheap Galaxy Bot

Something you might want to think about. At the moment, the bot performs an action only when the users access equals something. Surely you want to have fine grain control of access permissions so that an admin at level 100 can perform commands that require level 10 or above.
I'd suggest a function that returns true/false if the person has *enough* access to perform a given command - rather than checking for equality of access levels.
(it'd also allow you to centralise the whole thing rather than scattering authentication throughout the code )

Also - you might want to allow the bot to join channels on P autoinvites

edit: one possible danger - i'm not sure if irclib handles flood protection or not ( i would hope it does ) but if not, when incoming is reported - the bot sends two messages out for every one report it gets. One person could get it to flood itself off the network repeatedly if it doesnt throttle itself
__________________
Phil^

Last edited by Phil^; 27 Dec 2008 at 23:18.
Phil^ is offline   Reply With Quote
Unread 28 Dec 2008, 03:18   #8
Hunterrrr
Blah Blah Blah
 
Join Date: Mar 2008
Posts: 622
Hunterrrr has a spectacular aura aboutHunterrrr has a spectacular aura aboutHunterrrr has a spectacular aura about
Re: Isaac - A Cheap Galaxy Bot

hmm it should run with cygwin
__________________
If you can't amaze people with your intelligence, confuse them with your bullshit.
BANANA ALLIANCE!!
Hunterrrr is offline   Reply With Quote
Unread 28 Dec 2008, 17:43   #9
Phil^
Insomniac
 
Phil^'s Avatar
 
Join Date: May 2003
Posts: 3,583
Phil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus would
Re: Isaac - A Cheap Galaxy Bot

you shouldnt even need cygwin, there is a native windows version of python
__________________
Phil^
Phil^ is offline   Reply With Quote
Unread 28 Dec 2008, 19:12   #10
Hunterrrr
Blah Blah Blah
 
Join Date: Mar 2008
Posts: 622
Hunterrrr has a spectacular aura aboutHunterrrr has a spectacular aura aboutHunterrrr has a spectacular aura about
Re: Isaac - A Cheap Galaxy Bot

ill try it after new year on windows
__________________
If you can't amaze people with your intelligence, confuse them with your bullshit.
BANANA ALLIANCE!!
Hunterrrr is offline   Reply With Quote
Unread 28 Dec 2008, 19:17   #11
morrow
Registered User
 
Join Date: Aug 2008
Posts: 25
morrow is just really nicemorrow is just really nicemorrow is just really nicemorrow is just really nicemorrow is just really nice
Re: Isaac - A Cheap Galaxy Bot

Hej,

thanks for the generous amount of feedback. I appreciate it. I'd like to make some comments as well :)

1) Python + Windows + Original Motivation for a Python Bot

First off, indeed installing and running Python on Windows is a piece of cake; no Cygwin required.

Having said that, I must say that my choice of Python was so that it could be run as a standalone process on some server and would not depend on some IRC client which usually only run on workstations, which are not up and connected (or are at least not meant to be) 24/7.

Nevertheless, I'm quite willing to make a short guide describing the steps how to set up the bot on a Windows box (down the road though, since I don't even have access to one atm). On the other hand, I reckon anyone that has access to Unix box, will be quite able to set it up himself.

2) Coords -> Defchan Mapping / Channel vs. PMs

Indeed the lack of runtime configuration is the gravest shortcoming. I'll set to work on that as soon as possible; I'm a bit undecided on SQLite vs. a simple text file, but I'll do some research and maybe PM some of you (ellonweb) on IRC :).

Regarding the acceptance of messages in Channel vs. PMs, there'll probably an option for the user to set what the bot will accept (as I personally think a defence relay bot should only accept channel messages so that all people in the galaxy can see what's happening [then again, it does notify if the incoming is relayed]). Some food for my own head here :).

3) Flooding / IRC Related Issues

Good point you raise, Phil! I didn't think about that at all. I'll do some digging in the irclib code and implement some throttling mechanism if irclib doesn't take care of that.

4) P Invites / Access Levels

My original was for the bot to get a list of his P accesses after connection and then initiate a P invite for himself to all the channels with access records. Naturally, it could also be made to auto-join on a "normal" (non self requested) P invite, but I haven't decided on a final bot permissions model yet.

With that in mind, I'm not sure how you can list all your own access levels through P, but I imagine there's a command somewhere.

As for some finer grained access control, thanks for your input as well. I'll implement something better once the bot has more commands it will react; as said above, there'll probably be some access control as to who can invite the bot where. Anyway, right now all it can do is "die", so the 10 and 100 are dummy levels :).

5) Perl Bot

Citing the lack of users with ability to run Perl bots to be holding you back from releasing the source doesn't sound like a very good reason to me, Gabriel! (only my humble opinion ofc)

Unless you have more pressing constraints, I think you should just go ahead and release your source, I'm sure everyone would profit :).

Thanks again everyone. I'll keep you posted.

Cheers,
- morrow
__________________
Denial - Evolution

Last edited by morrow; 28 Dec 2008 at 19:24.
morrow is offline   Reply With Quote
Unread 28 Dec 2008, 21:19   #12
Banned
Banned
 
Banned's Avatar
 
Join Date: Jul 2003
Location: ******
Posts: 2,326
Banned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so little
Re: Isaac - A Cheap Galaxy Bot

Quote:
Originally Posted by morrow View Post

4) P Invites / Access Levels

My original was for the bot to get a list of his P accesses after connection and then initiate a P invite for himself to all the channels with access records. Naturally, it could also be made to auto-join on a "normal" (non self requested) P invite, but I haven't decided on a final bot permissions model yet.

With that in mind, I'm not sure how you can list all your own access levels through P, but I imagine there's a command somewhere.

As for some finer grained access control, thanks for your input as well. I'll implement something better once the bot has more commands it will react; as said above, there'll probably be some access control as to who can invite the bot where. Anyway, right now all it can do is "die", so the 10 and 100 are dummy levels .
What I do with Munin is to set autoinvite on for any channels I want Munin to join. What you could do is privmsg P :info botname, that'll return all the channels the bot has access to and level. Regexing that out and manually messaging P for each channel should work. Be warned though, you're liable to get ignored by P after a couple if you're not careful. Using autoinvite is better, but requires doing something upfront.

In fact, thinking about it, I'd redo addchan/galchan in Munin to always accept input (even if the channel is already added), but when the channel's already in Munin, make sure to send P set autoinvite on. Sure, it could DoS Munin's access to P, but only people with privs could use it anyway.
Banned is offline   Reply With Quote
Unread 28 Dec 2008, 22:39   #13
Gabriel
Gabba gabba hey hey
 
Join Date: Aug 2008
Posts: 212
Gabriel has a spectacular aura aboutGabriel has a spectacular aura aboutGabriel has a spectacular aura about
Re: Isaac - A Cheap Galaxy Bot

If it's just a simple bot for a single gal chan then joining on invite seems a bit of a security risk, you only want it joining one chan so log into P, +x, PRIVMSG p invite $channel; join $channel; would seem a bit safer, but that's just a personal preference. This also assumes the gal channel is P registered and invite only. Multiple options should be available for maximum flexibility.
Gabriel is offline   Reply With Quote
Unread 30 Dec 2008, 06:31   #14
mPulse
p3nguins Master Chief
 
mPulse's Avatar
 
Join Date: Jan 2008
Posts: 157
mPulse is a glorious beacon of lightmPulse is a glorious beacon of lightmPulse is a glorious beacon of lightmPulse is a glorious beacon of lightmPulse is a glorious beacon of lightmPulse is a glorious beacon of light
Re: Isaac - A Cheap Galaxy Bot

morrow,

If you do decide to manually message P for invite's, try to trottle it to about one request per 5 seconds, as P can get (as previously mentioned) a little narky if you spam him.

When your testing it drop into #cservice and give one of us a shout to alert us to your testing; that way we can cancel the ignore if your bot spams P!

(verify an admin by typing.... /msg p verify pnick)


mPulse
__________________
For all your IRC needs please head to

http://www.netgamers.org
irc.netgamers.org

Feel free to drop into #netgamers for a chat!
If you have any P related questions just join #cservice

For Planetarion related questions and general game help, please join #Support


NetGamers - Our support staff are fkn awesome.
mPulse is offline   Reply With Quote
Unread 30 Dec 2008, 22:39   #15
morrow
Registered User
 
Join Date: Aug 2008
Posts: 25
morrow is just really nicemorrow is just really nicemorrow is just really nicemorrow is just really nicemorrow is just really nice
Re: Isaac - A Cheap Galaxy Bot

Hej,

I've implemented defence channel maintenance via three commands (run the help command for details). The data is also saved in a CSV file (isaac.csv) which is written every time the dictionary is updated.

I also set up a little homepage (mind the space):

ht tp://cheleb.n et/wordpress/index.php/isaac-pa-galaxy-bot

The ToDo list still contains some points, but I think the most important functions should work now.

Edit: Shameless Cut&Paste from ChangeLog:

# r2 - 30-12-20008
#
# * Added GPL License
# * Only Consider "Attack" Fleets (Ignore Return and Defend)
# * Planet <-> Defchan Mapping now saved in CSV File
# * Planet <-> Defchan Mapping updated at runtime via "addchan", "delchan", and "showchan"
# * CTCP Version Reply


Cheers,
- morrow
__________________
Denial - Evolution

Last edited by morrow; 30 Dec 2008 at 22:44.
morrow is offline   Reply With Quote
Unread 25 Jan 2009, 16:01   #16
Zeyi
Tides of Fire
 
Join Date: Feb 2008
Location: UK
Posts: 318
Zeyi is just really niceZeyi is just really niceZeyi is just really niceZeyi is just really niceZeyi is just really nice
Re: Isaac - A Cheap Galaxy Bot

I liked the idea of a small galaxy bot, so in the hope morrow will continue developing this I've just put together this little windows guide to save him the trouble.

Download Python 2.6.1 from http://www.python.org/download/
(The Windows MSI - http://www.python.org/ftp/python/2.6.1/python-2.6.1.msi)

Download the IRC Lib - http://sourceforge.net/project/showf...group_id=38297

Install Python - it should by default install to C:\Python26

Now go to your desktop --> Right click on "My Computer" --> Properties.

Click on the advanced tab, look at the bottom for Environmental variables. Open it and look for the value "PATH" click edit.

Add ";C:\Python26" to the end of it.

OK That's Python Setup.

To install the IRC Lib:

Unzip/rar, Move the new folder into your C:\Python26.

Click start --> Run --> Type in "cmd" press Enter.

Command prompt opens, type "cd C:\Python26\python-irclib-0.4.8" or whatever you're IRC lib folder is called.

Now in command prompt type "python setup.py install".

This should work, if you get an error you're either using Python 3.0 or you have not set the environmental variable.

Now take the isaac-r02.py you've downloaded (the bot) and stick it in Python26. Edit the P details to suit your needs.

Make a new file called "isaac.csv" in there aswell otherwise you get an error.

In command prompt "cd C:\Python26"
and then "python isaac-r02.py"
Check your IRC channl it should have joined, if you close the command prompt the bot will exit.

I'll make a batch file later to make this last part easier.
__________________
Quote:
"Hold the newsreader's nose squarely, waiter, or friendly milk will countermand my trousers."
Zeyi is offline   Reply With Quote
Unread 25 Jan 2009, 16:09   #17
ellonweb
Registered User
 
Join Date: Nov 2008
Posts: 401
ellonweb has a brilliant futureellonweb has a brilliant futureellonweb has a brilliant futureellonweb has a brilliant futureellonweb has a brilliant futureellonweb has a brilliant futureellonweb has a brilliant futureellonweb has a brilliant futureellonweb has a brilliant futureellonweb has a brilliant futureellonweb has a brilliant future
Re: Isaac - A Cheap Galaxy Bot

Quote:
Originally Posted by Zeyi View Post
Now go to your desktop --> Right click on "My Computer" --> Properties.

Click on the advanced tab, look at the bottom for Environmental variables. Open it and look for the value "PATH" click edit.
For Windows Vista it's slightly different. My Computer -> Properties. Then on the left pane there is "Advanced system settings". Then go to the Advanced tab, and then Environmental variables.


For people that don't want to change these advanced settings, you can do so as long as your DOS prompt is running from the location you installed Python (C:\Python) or you prepend all "python" commands with that location.
ellonweb is offline   Reply With Quote
Unread 25 Jan 2009, 22:20   #18
morrow
Registered User
 
Join Date: Aug 2008
Posts: 25
morrow is just really nicemorrow is just really nicemorrow is just really nicemorrow is just really nicemorrow is just really nice
Re: Isaac - A Cheap Galaxy Bot

Awesome, Zeyi :)

There's a third release ready that mainly improves usability. I'll have to tweak a couple of small things, but I'll release it soon (about damn time with the round having started :)).

- morrow
__________________
Denial - Evolution
morrow is offline   Reply With Quote
Unread 3 Feb 2009, 01:12   #19
morrow
Registered User
 
Join Date: Aug 2008
Posts: 25
morrow is just really nicemorrow is just really nicemorrow is just really nicemorrow is just really nicemorrow is just really nice
Re: Isaac - A Cheap Galaxy Bot

Hola!

New release can be grabbed from there (single files):

ht tp://ch eleb.net/~volker/isaac/r03/

or (archive):

ht tp://chel eb.net/~volker/isaac/r03/isaac-r03.tar.bz2

Note the marvelous README file with setting up instructions!

The ReadMe is also prettified in HTML:

ht tp://che leb.net/wordpress/index.php/isaac-pa-galaxy-bot
__________________
Denial - Evolution
morrow is offline   Reply With Quote
Unread 4 Feb 2009, 15:50   #20
morrow
Registered User
 
Join Date: Aug 2008
Posts: 25
morrow is just really nicemorrow is just really nicemorrow is just really nicemorrow is just really nicemorrow is just really nice
Re: Isaac - A Cheap Galaxy Bot

Fixed some issues related to the config files. Chances are if r03 didn't work, r03a should now work for you. Thx to |2on for reporting :).
__________________
Denial - Evolution
morrow is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Forum Jump


All times are GMT +1. The time now is 21:21.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018