Nick: Difference between revisions

From Scriptwiki
Jump to navigation Jump to search
Doomie (talk | contribs)
added relatedraws template
Adding information about what nicknames are valid and what is not,
Line 1: Line 1:
{{stub}}
Changes your nickname.
Changes your nickname.


  /nick new-nick
  /nick new-nick


'''Note:'''
*Valid nickname charactors are as follows: 0-9a-z\[]^_`{|}-
*A nickname must also '''not''' begin with a numeric or a hyphen (-).
*Some ircd reserve single charaecter nicknames for service bots, QuakeNET '''is''' an example of this.
''Here is an exmample to check if %nick is a valid nickname or not:''
[[var]] %nick = /V/alid
[[if]] ([[$regex]](%nick,%i,/^([a-z\Q\|[]^_`{}-\E](-\w\Q\|[]^_`{}-\E)*)/i)) {
  [[echo]] -ag [[$regml]](1) is a valid nickname!
}
[[If-then-else|else]] { echo -ag %nick is not a valid nickname! }
'''Note:''' The above example, if you feed it \Valid!nvalid it would return it as a valid nickname, although the only valid part of the nick, is \Valid.  If you type /nick \Valid!nvalid the ircd would trim the nick to \Valid, this is why in the echo of a valid nickname we use $regml(1) instead of %nick, this is a back reference to the valid nickname captured.
If you also want to check that the nickname is atleast two characters long you can replace the * with a + this will make sure that the second exists:
/^([a-z\Q\|[]^_`{}-\E](-\w\Q\|[]^_`{}-\E)+)/i
The example below will only match if the whole nickname is valid, so it won't trumpcate the nickname:
/^([a-z\Q\|[]^_`{}-\E](-\w\Q\|[]^_`{}-\E)*)$/i
== See Also ==
== See Also ==
{{Relatedraws|nick}}
{{Relatedraws|nick}}


[[Category:Basic IRC commands]]
[[Category:Basic IRC commands]]

Revision as of 16:45, 25 November 2005

Changes your nickname.

/nick new-nick

Note:

  • Valid nickname charactors are as follows: 0-9a-z\[]^_`{|}-
  • A nickname must also not begin with a numeric or a hyphen (-).
  • Some ircd reserve single charaecter nicknames for service bots, QuakeNET is an example of this.

Here is an exmample to check if %nick is a valid nickname or not:

var %nick = /V/alid
if ($regex(%nick,%i,/^([a-z\Q\|[]^_`{}-\E](-\w\Q\|[]^_`{}-\E)*)/i)) {
  echo -ag $regml(1) is a valid nickname!
}
else { echo -ag %nick is not a valid nickname! }

Note: The above example, if you feed it \Valid!nvalid it would return it as a valid nickname, although the only valid part of the nick, is \Valid. If you type /nick \Valid!nvalid the ircd would trim the nick to \Valid, this is why in the echo of a valid nickname we use $regml(1) instead of %nick, this is a back reference to the valid nickname captured.

If you also want to check that the nickname is atleast two characters long you can replace the * with a + this will make sure that the second exists:

/^([a-z\Q\|[]^_`{}-\E](-\w\Q\|[]^_`{}-\E)+)/i


The example below will only match if the whole nickname is valid, so it won't trumpcate the nickname:

/^([a-z\Q\|[]^_`{}-\E](-\w\Q\|[]^_`{}-\E)*)$/i

See Also

Raws related to /nick