mIRC Homepage
Posted By: Spike How would i do a !join command? - 28/05/15 01:03 AM
So i have plans for my twitch.tv bot that will let people go to its channel and do !join can anyone help?
Posted By: powerade661 Re: How would i do a !join command? - 28/05/15 02:10 AM
Sure I will give you a script that was developed by Majeye. Take note you must join the channel your bot is on in mIRC for this to work. To do this you type /join #usernameforyourbot in any mIRC window. Now with this in mind, let me explain to you what this does before you put it in mIRC. Basically on*text means if a text is inputted in this case it is "!join:#examplechannel" then join that channel to ".join $chr(35) $+ $nick" this is where it knows where to join. $nick means username, or nickname if you will.

So with all of this, if I go to your bot's channel and type "!join" this script says ok I need to join $nick in this case it would be powerade661 and then it forces your bot to join my channel. The "msg # whatever is typed here" is writing that message in your channel. The "#" indicates what the channel is, so it knows to post the message in your channel. You will also notice "/me" this is a command in Twitch that changes your text color to whatever color you chose for your bot to be. Hope this helps, if you have any questions, do not hesitate to ask. smile

Regards,
Powerade661

Code:
on *:text:!join:#BOTNAMEHERE: {
  msg # /me is joining $nick $+ 's chat. Don't forget to type /mod BOTNAMEHERE in your own channel to ensure all commands work properly, if you do not mod the bot, it will leave your channel.
  .join $chr(35) $+ $nick
}
Posted By: Spike Re: How would i do a !join command? - 28/05/15 02:37 AM
Originally Posted By: powerade661
Sure I will give you a script that was developed by Majeye. Take note you must join the channel your bot is on in mIRC for this to work. To do this you type /join #usernameforyourbot in any mIRC window. Now with this in mind, let me explain to you what this does before you put it in mIRC. Basically on*text means if a text is inputted in this case it is "!join:#examplechannel" then join that channel to ".join $chr(35) $+ $nick" this is where it knows where to join. $nick means username, or nickname if you will.

So with all of this, if I go to your bot's channel and type "!join" this script says ok I need to join $nick in this case it would be powerade661 and then it forces your bot to join my channel. The "msg # whatever is typed here" is writing that message in your channel. The "#" indicates what the channel is, so it knows to post the message in your channel. You will also notice "/me" this is a command in Twitch that changes your text color to whatever color you chose for your bot to be. Hope this helps, if you have any questions, do not hesitate to ask. smile

Regards,
Powerade661

Code:
on *:text:!join:#BOTNAMEHERE: {
  msg # /me is joining $nick $+ 's chat. Don't forget to type /mod BOTNAMEHERE in your own channel to ensure all commands work properly, if you do not mod the bot, it will leave your channel.
  .join $chr(35) $+ $nick
}

It wasn't working at first but it was just a typo of the bot's name sorry about that.
Posted By: Spike Re: How would i do a !join command? - 28/05/15 02:38 AM
Originally Posted By: powerade661
Sure I will give you a script that was developed by Majeye. Take note you must join the channel your bot is on in mIRC for this to work. To do this you type /join #usernameforyourbot in any mIRC window. Now with this in mind, let me explain to you what this does before you put it in mIRC. Basically on*text means if a text is inputted in this case it is "!join:#examplechannel" then join that channel to ".join $chr(35) $+ $nick" this is where it knows where to join. $nick means username, or nickname if you will.

So with all of this, if I go to your bot's channel and type "!join" this script says ok I need to join $nick in this case it would be powerade661 and then it forces your bot to join my channel. The "msg # whatever is typed here" is writing that message in your channel. The "#" indicates what the channel is, so it knows to post the message in your channel. You will also notice "/me" this is a command in Twitch that changes your text color to whatever color you chose for your bot to be. Hope this helps, if you have any questions, do not hesitate to ask. smile

Regards,
Powerade661

Code:
on *:text:!join:#BOTNAMEHERE: {
  msg # /me is joining $nick $+ 's chat. Don't forget to type /mod BOTNAMEHERE in your own channel to ensure all commands work properly, if you do not mod the bot, it will leave your channel.
  .join $chr(35) $+ $nick
}

But is there any way to make it so mIRC adds it to its favs list so if the bot goes down or i have to restart it, It would re join right away?
Posted By: powerade661 Re: How would i do a !join command? - 28/05/15 02:48 AM
I have a better solution for you since I am sure you are going to use this for multiple people or possibly only yourself. This is a script that I developed. I will explain this as well.
So the "on*:connect" basically tells mIRC when you connect to a server, to join these channels on that server. Take note you can put as many as you want below. I suggest you put this in your remote file. The "/join" is telling mIRC to join those specified channels, in this case it is channel1, channel2 and channel3.

This script will automatically start when you start mIRC if for whatever reason the bot goes down. smile

Code:
ON *:CONNECT: { 
  /join #channel1
  /join #channel2
  /join #channel3
}

Posted By: Spike Re: How would i do a !join command? - 28/05/15 02:59 AM
Originally Posted By: powerade661
I have a better solution for you since I am sure you are going to use this for multiple people or possibly only yourself. This is a script that I developed. I will explain this as well.
So the "on*:connect" basically tells mIRC when you connect to a server, to join these channels on that server. Take note you can put as many as you want below. I suggest you put this in your remote file. The "/join" is telling mIRC to join those specified channels, in this case it is channel1, channel2 and channel3.

This script will automatically start when you start mIRC if for whatever reason it goes down. smile

Code:
ON *:CONNECT: { 
  /join #channel1
  /join #channel2
  /join #channel3
}


Well as your script you gave me for the basic !join it says something in the bots channel but is there a way to make it say something in the channel that did !join to tell the streamer that the bot has joined?
Posted By: powerade661 Re: How would i do a !join command? - 28/05/15 03:10 AM
Yes there is, in this case you will need a timer. The 1 in .timer.joining is how many times it will display the message before it stops the timer. If you did 0 it wouldn't stop the timer until you told it to do so. The 7 in the .timer.joining is the interval at which the timer is using. So for instance .timer.joining 2 7 will display the message twice every 7 seconds and then stop after it has displayed the two messages.

Code:
on *:text:!join:#BOTSNAMEHERE: {
  msg # /me is joining $nick $+ 's chat. Don't forget to type /mod BOTNAMEHERE in your own channel to ensure all commands work properly, if you do not mod the bot, it will leave your channel.
  .timer.joining 1 7 msg $chr(35) $+ $nick Bot has entered your channel.
}
Posted By: Spike Re: How would i do a !join command? - 28/05/15 03:22 AM
Originally Posted By: powerade661
Yes there is, in this case you will need a timer. The 1 in .timer.joining is how many times it will display the message before it stops the timer. If you did 0 it wouldn't stop the timer until you told it to do so. The 7 in the .timer.joining is the interval at which the timer is using. So for instance .timer.joining 2 7 will display the message twice every 7 seconds and then stop after it has displayed the two messages.

Code:
on *:text:!join:#BOTSNAMEHERE: {
  msg # /me is joining $nick $+ 's chat. Don't forget to type /mod BOTNAMEHERE in your own channel to ensure all commands work properly, if you do not mod the bot, it will leave your channel.
  .timer.joining 1 7 msg $chr(35) $+ $nick Bot has entered your channel.
}

Thank you very much. Now i just gotta find a way to make the bot always join the channels i need a way for so when they do !join it would like add them to a list and would join them all but we'll see.
Posted By: powerade661 Re: How would i do a !join command? - 28/05/15 03:27 AM
This script will give you that, you would just update it if someone new joins.

Code:
ON *:CONNECT: { 
  /join #channel1
  /join #channel2
  /join #channel3
}
Posted By: Spike Re: How would i do a !join command? - 28/05/15 03:34 AM
Originally Posted By: powerade661
This script will give you that, you would just update it if someone new joins.

Code:
ON *:CONNECT: { 
  /join #channel1
  /join #channel2
  /join #channel3
}

Well you gotta look ahead. If a lot of people started using that. I would have to do a lot of adding for every channel, It would work at this current stage but would take a lot work if people kept making it join..
Posted By: powerade661 Re: How would i do a !join command? - 28/05/15 03:58 AM
To be honest, I am not sure how you would do this. You could do
writeini join.ini
writeini -n join.ini /join #channel
but the problem is, you would have to be able to line them up correctly for it to work. Like I have presented above.
Posted By: Spike Re: How would i do a !join command? - 28/05/15 04:04 AM
Originally Posted By: powerade661
To be honest, I am not sure how you would do this. You could do
writeini join.ini
writeini -n /join #channel
but the problem is, you would have to be able to line them up correctly for it to work. Like I have presented above.


I'll start to worry about it when i really "have" to, Atm i do not.
Posted By: powerade661 Re: How would i do a !join command? - 28/05/15 04:16 AM
Very well, I wish you the best of luck! smile
Posted By: powerade661 Re: How would i do a !join command? - 28/05/15 04:24 AM
Give me a minute, I think I may have an idea as to how to do this, if you are still interested. I will report back to you.
Posted By: Spike Re: How would i do a !join command? - 28/05/15 05:14 AM
Originally Posted By: powerade661
Give me a minute, I think I may have an idea as to how to do this, if you are still interested. I will report back to you.

Anything helps
Posted By: powerade661 Re: How would i do a !join command? - 28/05/15 05:51 AM
I can't seem to be able to figure it out. I apologize for getting your hopes up. I do know it has something to do with the /writeini command though.
Posted By: Sakana Re: How would i do a !join command? - 28/05/15 05:55 AM
Seems like this is what you're looking for

Code:
on *:text:!join:#BOTNAMEHERE: {
var %chan = $chr(35) $+ $nick
join %chan 
set %botchans %botchans %chan
msg # I will join your channel!
}


alias autojoin {
var %i 1
while ($gettok($1-,%i,32)) {
.timer 1 $calc(%i * 5) join $gettok($1-,%i,32)
inc %i
}
}


ON *:CONNECT: if ($me == BOT_NAME) { autojoin %botchans }
Posted By: powerade661 Re: How would i do a !join command? - 28/05/15 06:07 AM
Ah I see. This is making the usernames into a variable if I am reading this correctly, and then joins those usernames, when it is connected to the server. Am I wrong? Let me ask you something, I currently have the script that you see above(not yours) for joining channels, is it possible to write to that ini file or how would I add the current usernames that are in that script(yours) into the variables?
Posted By: Sakana Re: How would i do a !join command? - 28/05/15 06:33 AM
Yeah, that's right, and it joins with 5 sec delay between joins to avoid getting banned

You can use any storing method you like, it doesn't really matter which. Saving to a .ini just seems a bit weird to me since with ini files you have a key=value structure, but here we only really have values (channel names)

but you could do something like

/writeini -n botchans.ini botchans $lines(botchans.ini) %chan

which should assign a number to the channel name
Posted By: powerade661 Re: How would i do a !join command? - 28/05/15 06:38 AM
No I am saying is the usernames added in the variables tab? Would I just add what I currently have to that?
Posted By: Sakana Re: How would i do a !join command? - 28/05/15 06:40 AM
yes, it will be added to the variables tab and should look like

%botchans #chan1 #chan2 #chan3
Posted By: powerade661 Re: How would i do a !join command? - 28/05/15 06:42 AM
Thanks man I appreciate it. I was curious as to how to do this but couldn't quite figure it out either.
Posted By: Spike Re: How would i do a !join command? - 29/05/15 02:23 AM
Originally Posted By: Sakana
Seems like this is what you're looking for

Code:
on *:text:!join:#BOTNAMEHERE: {
var %chan = $chr(35) $+ $nick
join %chan 
set %botchans %botchans %chan
msg # I will join your channel!
}


alias autojoin {
var %i 1
while ($gettok($1-,%i,32)) {
.timer 1 $calc(%i * 5) join $gettok($1-,%i,32)
inc %i
}
}


ON *:CONNECT: if ($me == BOT_NAME) { autojoin %botchans }

Would you know a way for me to make a !leave command with all that also?
Posted By: Belhifet Re: How would i do a !join command? - 29/05/15 02:52 AM
Ya use
$remtok(%botchans, #, 1, 32)
/part #
Posted By: Majeye Re: How would i do a !join command? - 02/06/15 07:50 AM
I apologize for not seeing this thread sooner.


If there is anything I can help with, let me know.

(sorry I haven't been around much, work is taking up a lot of my time)
© mIRC Discussion Forums