mIRC Home    About    Download    Register    News    Help

Print Thread
#246966 15/07/14 07:53 PM
Joined: Jul 2014
Posts: 1
E
Mostly harmless
OP Offline
Mostly harmless
E
Joined: Jul 2014
Posts: 1
For my Twitch.tv bot, when someone joins, I want the bot to say "Hello (username)!" e.g. "Hello Electrospeed!" But, when I try to add a ! to the end of $nick, it stops working.

Also, the names of other users are not capitalized. It says "Hello electrospeed" instead of "Hello Electrospeed!" Is there any way to fix that?

Thirdly, since I'm new to this, when people say !ban (user), I want the bot to say "(user) has been banned by $nick" and since I have no idea how to do that, could somebody help? Or at least point me to somewhere I can figure it out...

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
When appending something to an identifier you must use the $+ function first. $nick! wont work since this will become a totally new identifier. use $nick $+ ! which will let you evaluate $nick into the value first and then append the ! afterwards.

Your second request is not a built in feature. I suggest you create your own custom alias for this. You can simply paste this into your remote.ini and this will work wonders for you.
Code:
alias capital return $upper($left($1,1)) $+ $mid($1,2-)
Now whenever you use $nick in your messages you can use $capital($nick) and it will use the value with a capital starting letter.

As for your third request:
Code:
on *:text:!ban *:#: { 
  if ($nick !isop #) || ($me !isop #) return
  ;However you ban people I do not know. Just insert it here, probably something like " /ban # $2 " or something.
  msg # $2 was banned by $nick $+ . $iif($3,Reason: $3-,$null)
}
The first line will check for if the user writing or the bot's level in the #channel, if both aren't op then the script won't work.
The 2nd line is where you input your ban method, you probably know that better than I do.
And the 3rd line will message the channel that the target ($2) has been banned by the user ($nick) If there is anything after the target that will also be included in the message as a reason.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Mar 2015
Posts: 1
B
Mostly harmless
Offline
Mostly harmless
B
Joined: Mar 2015
Posts: 1
I have a question regarding the capitalization of the username.

Twitch gives the possibility to capitalize various letters in a username (such as "MrBlackWhiteX" or "TNTAlchemist").

Is there a way to create an alias or somehing that allows me to output $nick in the correct Twitch capitalization?

Kind Regards

Last edited by BlackWhiteX; 29/03/15 04:12 PM.
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Do you know where to pull the info from?
How does Twitch tell you that mrblackwhitex is supposed to be MrBlackWhiteX?


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
I use something that looks like this..I edited this a couple times rq because there was tons of stuff in it that wouldn't make sense to post here..but

Code:
alias twitchname {
  if ($hget(nickformat) == $null) { hmake nickformat }
  if ($hget(nickformat,$1)) { return $iif($hget(nickformat,$1) == $null,$1,$hget(nickformat,$1)) }
  var %json https://api.twitch.tv/kraken/users/ $+ $1
  JSONOpen -ud nicename %json
  hadd nickformat $1 $json(nicename,display_name)
  return $iif($hget(nickformat,$1) == $null,$1,$hget(nickformat,$1))
}


obv you will replace any messages with $nick with $twitchname($nick) or w/e the identifier for the name you want to use.

Last edited by Belhifet; 29/03/15 08:28 PM.
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
using this, he'll need a copy of my JSON parser

See my signature for link


I am SReject
My Stuff

Link Copied to Clipboard