Top

URL Bot v3


mIRC Code
+ 1 likes
Please Register to submit score.
Bookmark and Share
Average Score  0.0 (of 0 scores)
Date Added  Jun 11, 2009
Last Updated  Jul 22, 2009
Tags  bot  link  url 

Introduction

Finally got around to updating this one ^^

Allow users to store a link on the bot

Commands:
!url add <link> - add URL(only stores 1)
!url edit <link> - replace URL with a new one
!url del - delete your URL
!url view <nick> - view another nick's URL

The HasURL level is mostly for easy tracking of who has added a URL

I could use a script that lists the nicks that have URLs, if anyone would like to help out with this, it would be appreciated ^^

Updates: URLs are now stored in a hash table
non-links are filtered by bot
jonesy44's regex used

Grab the Code

/*
<:>:<:>:<:>:<:>:<:>:<:>:<:>
WEBSITE BOT<:>:<:>:<:>:<:>:
BY SK68<:>:<:>:<:>:<:>:<:>:
<:>:<:>:<:>:<:>:<:>:<:>:<:>
 
Syntax: !url <add | edit | del | view> <link(for add and edit) | nick(for view)>
*/
on *:START: { hmake urls 10
if ($isfile(urls.hsh)) hload urls urls.hsh
}
else
on *:TEXT:!url*:#: { if (!$2) { 
    .notice $nick please use !url <add/del/edit/view>
  }
  else {
    if ($2 == add) { 
      if ($regex($3,/((http:\/\/?)(www\.?).*.\.*)/Si)) {
        if (!$hget(urls,$nick)) {
          hadd urls $nick $3
          privmsg $chan $nick $+ 's URL set to $3
        }
        else { 
          privmsg $chan I already have a URL for you, $nick
        }
      }
      else { 
        privmsg $chan that is not a valid link
      }
    }
    elseif ($2 == edit) { if ($regex($3,/((http:\/\/?)(www\.?).*.\.*)/Si)) {
        if (!$hget(urls,$nick)) { 
          privmsg $chan You dont have a URL to edit, $nick
        }
        else { 
          hadd urls $nick $3
          privmsg $chan $nick $+ 's URL has been changed to $3
        }
      }
      else { 
        privmsg $chan that is not a valid link
      }
    }
    elseif ($2 == view) { if (!$hget(urls,$3)) { 
        privmsg $chan I dont have a URL for $+($3,$chr(44),$nick,$chr(44)) why dont you ask them to add one
      }
      else { 
        notice $nick $3 $+ 's URL is $hget(urls,$3)
      }
      else { 
        privmsg $chan that is not a valid link
      }
    }
    elseif ($2 == del) { 
      if (!$hget(urls,$nick)) { 
        privmsg $chan You dont have a URL to delete, $nick
      }
      else { 
        hdel urls $nick
        privmsg $chan $nick $+ 's URL has been deleted
      }
    }
    else { 
      privmsg $chan Incorrect syntax
    }
  }
}
on *:EXIT: { hsave -o urls urls.hsh | hfree urls }
 

Comments

  (13)  RSS
Jethro_
Comments: 438
 
mIRC Snippet:  URL Bot v3
Posted on Jun 11, 2009 8:28 pm
What if the add is not even a link or url? You should use a regex to match only URLs.
Aucun50
Comments: 548
 
mIRC Snippet:  URL Bot v3
Posted on Jun 11, 2009 10:08 pm
Also this could use a lot of vars, maybe go with a ini file.
Jethro_
Comments: 438
 
mIRC Snippet:  URL Bot v3
Posted on Jun 11, 2009 10:15 pm
I'd opt for hash tables if I had a chance for similar script.
sk68
Comments: 61
 
mIRC Snippet:  URL Bot v3
Posted on Jun 12, 2009 10:00 am
oops, I guess I didnt think about the number of vars and invalid inputs, Im not really good with ini files but Ill read up on it and get to work ASAP :D
PATX
Comments: 389
 
mIRC Snippet:  URL Bot v3
Posted on Jun 14, 2009 5:54 pm
sk86 dis is like my script. ppl said da same thing use ini use hash. i personally like vars, tho hash is probaly ur best bet here. tho u went w. ini oh well.
jonesy44
Comments: 1,856
 
mIRC Snippet:  URL Bot v3
Posted on Jun 16, 2009 7:54 am
I'd use regex to match URL's, something like,

Code:
$regex(str,/((http:\/\/?)(www\.?).*.\.*)/Si)

$regml(1) - URL string
sk68
Comments: 61
 
mIRC Snippet:  URL Bot v3
Posted on Jul 22, 2009 11:05 am
UPDATE
jonesy44
Comments: 1,856
 
mIRC Snippet:  URL Bot v3
Posted on Jul 22, 2009 11:45 am
Replace "str" with $3 :)
sk68
Comments: 61
 
mIRC Snippet:  URL Bot v3
Posted on Jul 22, 2009 7:12 pm
uh...yea...I knew that >.>
Xaric
Comments: 14
 
mIRC Snippet:  URL Bot v3
Posted on Jul 25, 2009 6:50 pm
Can you add success string entries for the url?
sk68
Comments: 61
 
mIRC Snippet:  URL Bot v3
Posted on Jul 26, 2009 9:22 am
well, that depends...what?
Kirbeh_Pr0nz
Comments: 144
 
mIRC Snippet:  URL Bot v3
Posted on Aug 5, 2009 6:47 am
;O Bracket Heaven
sk68
Comments: 61
 
mIRC Snippet:  URL Bot v3
Posted on Aug 5, 2009 8:11 am
you obviously didnt see my store script >.<

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom