Page 1 of 1

Topic Management Script

PostPosted: Tue Oct 27, 2009 9:08 pm
by Henco
A little script I wrote for organising your channel's topic...
Code: Select all
Topic management script by Henco - irc.geekshed.net #henco
on 1:text:!maintopic *:%channel: {
  if ($nick isop $chan || $nick ishop $chan) {
    { /set %topic $2- | /topic $chan Topic: %topic %sep %ss %status %sep %info %sep %url }
  }
  else {
    /msg $chan Sorry, $nick only hops/ops can change status.
  }
}

on 1:text:!status *:%channel: {
  if ($nick isop $chan || $nick ishop $chan) {
    { /set %status $2- | /topic $chan Topic: %topic %sep %ss %status %sep %info %sep %url }
  }
  else {
    /msg $chan Sorry, $nick only ops can change status.
  }
}

on 1:text:!status2 *:%channel: {
  if ($nick isop $chan || $nick ishop $chan) {
    { /set %ss $2- | /topic $chan Topic: %topic %sep %ss %status %sep %info %sep %url }
  }
  else {
    /msg $chan Sorry, $nick only hops/ops can change status.
  }
}

on 1:text:!url *:%channel: {
  if ($nick isop $chan || $nick ishop $chan) {
    { /set %url $2- | /topic $chan Topic: %topic %sep %ss %status %sep %info %sep %url }
  }
  else {
    /msg $chan Sorry, $nick only ops can change status.
  }
}

on 1:text:!sep *:%channel: {
  if ($nick isop $chan || $nick ishop $chan) {
    { /set %sep $2- }
  }
  else {
    /msg $chan Sorry, $nick only ops can change separator.
  }
}

on 1:text:!trefresh:%channel: { topic $chan Topic: %topic %sep %ss %status %sep %info %sep %url }

on 1:text:!info *:%channel: {
  if ($nick isop $chan || $nick ishop $chan) {
    { /set %info $2- | /topic $chan Topic: %topic %sep %ss %status %sep %info %sep %url }
  }
  else {
    /msg $chan Sorry, $nick only ops can change topic info.
  }
}


When you first load the script, you'll need to type '/set %channel #yourchannelhere' (without quotes), to set your channel name.

The things to change/set are !maintopic,!status,!status2,!info and !url.

All these are segments of the topic, and are separated by a separator of your choice.
!status2 should be set to something like 'Henco is', and then !status set to something like 'here'. I have done this for ease of use so you only have to do !status here to change your status, no need for the 'Henco is'.

The !trefresh command is for when someone changes the topic manually, and you need to reset it to your bot's system, or when the topic is lost for whatever reason (eg. services down).

So, lets go through it:
First, you would load the script on your bot and then type '/set %channel #henco' (without the quotes, replacing #henco with your channel).
Then, you would type !sep followed by the seperator you want in your topic, e.g. !sep //

You would then set your topic with the !maintopic command, e.g. !maintopic Technology

Next, you would set your status using !status and !status2, e.g. !status2 Henco is, then !status somewhere

After this, you would set your channel info, e.g. !info Please add us to your autojoin :)

Finally, you would set your website URL, or if you dont have a website, you could use this for more info, e.g. !url http://henrycole.eu/

You would then have a topic that looks something along the lines of this: Topic: Technology // Henco is here // Please add us to your autojoin :) // http://henrycole.eu/

If you have any questions feel free to talk to me in whatever channels I may be in on geekshed, or pm me on these forums.

Hope it works well for you :)

Henco

Re: Topic Management Script

PostPosted: Wed Oct 28, 2009 1:51 am
by Ford
Nice instructions Henco :)

One thing I would add is that %channel can be more than one channel as long as you separate them by commas.
For instance /set %channel #chan1,#chan2,#chan3 <-- would make the script available in all 3 channels.

Re: Topic Management Script

PostPosted: Wed Oct 28, 2009 4:37 pm
by GrimReaper
Re: Topic Management Script

by Ford ยป Wed Oct 28, 2009 1:51 am
Nice instructions Henco

One thing I would add is that %channel can be more than one channel as long as you separate them by commas.
For instance /set %channel #chan1,#chan2,#chan3 <-- would make the script available in all 3 channels.


In reply to Ford's suggestions..

if you make the variables for %topic %sep %ss %status %sep %info %sep %url look like %topic. [ $+ [ $chan ] ] %sep. [ $+ [ $chan ] ] %ss. [ $+ [ $chan ] ] %status. [ $+ [ $chan ] ] %sep. [ $+ [ $chan ] ] %info. [ $+ [ $chan ] ] %sep. [ $+ [ $chan ] ] %url. [ $+ [ $chan ] ]

then you can do more than 3 channel's topics.. as it set's the variables for each channel.

Hope this helps you out.

Re: Topic Management Script

PostPosted: Wed Oct 28, 2009 8:54 pm
by Ford
Hello GrimReaper. Thats a lot of variables though. If I wanted to store channel topics in pieces like this, I would definitely use ini's.
I'm not a big fan of variables, but I'm not big on topics either :P
By the way, I did actually overlook the fact that it set all of those variables.
Speed Reading been Very Very bad for me :P

Re: Topic Management Script

PostPosted: Thu Oct 29, 2009 4:37 pm
by Henco
Thanks for your suggestions Ford, GrimReaper.

I'll have a play around and update it if and when I see fit, i've been making lots of changes to my bot recently so will probably be addign more scripts here anyway.

Henco :)