mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#260701 07/06/17 04:09 AM
Joined: Jun 2014
Posts: 52
D
Babel fish
OP Offline
Babel fish
D
Joined: Jun 2014
Posts: 52
I don't know what I am doing wrong, but I can't get my bot to whisper a user when the enter the channel. I thought msg would work just fine? Can anyone tell me what is wrong?
Code:
 
on *:join:#:{
  if ($nick !isin $read(UserList.txt, 1)) {
    msg $chan $nick If a person you do not know slanders a streamer or his viewers, go to your settings -> security https://www.twitch.tv/settings/security and at the bottom of the page block messages, whispers, and invites from people you do not follow. Hit "Save Changes" after you finish.
    write UserList.txt $nick
    }

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
msg $chan is the same as typing into the channel window
msg $nick opens a query window, which is probably not what you mean by "whisper".

I'm guessing by whisper that you mean
notice $nick

Joined: Jun 2014
Posts: 52
D
Babel fish
OP Offline
Babel fish
D
Joined: Jun 2014
Posts: 52
When I try that command, it says "unknown command".

Also, I found out that 'write' does not detect duplicates. Any suggestions on an easy way to just compile a list of users that join the stream? And an easy way to compare that list to a user joining the stream?

The only other way I can think of is using writeini, and giving each user a value of "1". (I don't think you can use writeini without a value?)

Joined: Jun 2014
Posts: 52
D
Babel fish
OP Offline
Babel fish
D
Joined: Jun 2014
Posts: 52
Anyone have an idea on why I can't whisper with my bot? I can type .w darthclide message into the window and it works, but I can't get it to work in the code?

Last edited by darthclide; 08/06/17 12:40 AM.
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
NOTICE is a command, as you can see with:

/help /notice

So you shouldn't see that error unless you have a badly written alias to replace it, or you typed it badly. Type this in any window:

//notice $me test

This should send a message to yourself. If you still get "unknown command" check to see if you've somehow created an alias of the same name:

//echo -a $isalias(notice) $isalias(notice).fname

If it says $false then you haven't replaced /notice with an alias, but if it says $true, it also shows you which file contains that alias. It's possible for the right combination of lines following a missing/extra curly-bracket in aliases.ini to confuse mIRC into thinking you've created an alias for something.

---

If your list is short enough, an easy way to detect duplicates is a %variable that can have max length of around 4000 before getting an error, so probably around 300-400 users. It's simplest to have the tokens separated by the space character, ASCII 32.

set %userslist $addtok(%userslist,$nick,32)

if someone changes their nick while in channel and you want the list to contain the new nick:

set %userslist $reptok(%userslist,$nick,$newnick,1,32)

You can't writeini without writing something, regardless whether the 'item' already exists in the .ini, so you could either write 0 or $false to it. or use remini to delete a section or item.

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
whisper isn't an mirc command. If you want help with a human-created alias, you'll have to show the code.

Joined: Jun 2014
Posts: 52
D
Babel fish
OP Offline
Babel fish
D
Joined: Jun 2014
Posts: 52
All I want is to send a whisper from my bot, to a viewer. As I said before ".w username message" works just fine if I type it into the window.

Joined: Jun 2014
Posts: 52
D
Babel fish
OP Offline
Babel fish
D
Joined: Jun 2014
Posts: 52
If I try the notice command in the window it says
-> -darthclide- hello

in the chat window, but in the status window it says
NOTICE Unknown command

No message is sent. Not a private message (which I do not want) or a whisper (which I do want)

It says $false when I do your command, which I already knew the answer to. All of my aliases are unique, I make sure of that.




My list will grow indefinitely as I will be logging every person who comes into the stream. It looks like I will have to just set each username with a value of 1, and cycle through the list everytime a user enters the channel. To ensure that a person does not receive the whisper every time they join.

Joined: Jan 2017
Posts: 57
Babel fish
Offline
Babel fish
Joined: Jan 2017
Posts: 57
Have you tried sending a normal chat message prefaced with /w? I've had a lot of luck with the following:
Code:
msg $chan /w username message

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Your answer seems a contradiction. Your mIRC is recognizing and not-recognizing the /notice command at the same time.

If I did
//asdfg $me test

There would be nothing in the way of a "->" message on screen, so the fact that you're getting that arrow message tells me that your mirc knows that /notice is a communications command. But on the other hand, you're visually seeing the message in status window that NOTICE is an unknown command.

The only way I can see both being true is if you have something that intercepts the ON NOTICE command and mutes it so you can't see the notice being received by you. I suspect that if you have another person willing to test with you, that if you did /notice that-nick message, that they would see it.

For NOTICE to be at the same time an unknown command - one way this could happen is if you have an alias trying to send a notice, except it has an alt-160 touching the /notice, so it looks like NOTICE is an unknown command, but what's really unknown is NOTICE $+ $chr(160)

As for your trouble with /w or /whisper, these are not mirc commands, they have to be an alias you created, and without letting us know what it is, we can't help with it.

Joined: Jun 2014
Posts: 52
D
Babel fish
OP Offline
Babel fish
D
Joined: Jun 2014
Posts: 52
I have no aliases using the word "notice" anywhere in my script, but I will post it here for you to look through. For the record, the exemptions to usernames are for persistent trolls who stick around more than a few months after being banned.

I also know it is a mess, but until my stream gets bigger, I can't be bothered to optimize it.

https://pastebin.com/Mn5X2YGS

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
thanks. I see this is 'a' script. I see it doesn't mention 'notice'. However it also doesn't contain the /w alias either. It does mention it once, but is used improperly. When you do:

/msg $chan /w message

It's the same as someone chatting into channel: /w message or typing in channel window:

/say /w message

So it's showing everyone "/w" instead of doing the mysterious whisper - which must be a handmade alias because it's not part of mIRC. You've got some other script messing around with the notice command, but that's a separate item.

Joined: Jun 2014
Posts: 52
D
Babel fish
OP Offline
Babel fish
D
Joined: Jun 2014
Posts: 52
You can look at my code getUser setUser and I have no idea why
1. No file is created, or written to
2. Why the bot shows this in the window?
<@darth_bot> /w the_mighty_salad I am darthclide's bot, let me know if you received this whisper

But if I manually create a command that uses:
msg $chan /w username message

It does not show anything in my window (indicating it actually sent?)

Joined: Jun 2014
Posts: 52
D
Babel fish
OP Offline
Babel fish
D
Joined: Jun 2014
Posts: 52
There is only 1 script file. Everything you see there is all that exists.

So how do I modify /w in the aliases section to do what I want?

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
1. You're using the identifier format for getuser but the dollar is missing, so the code is setting %here_before to the literal string "getUser($chan,$nick)" without the channel and nick being evaluated.

Since that variable is never going to be the numeral 1, it always branches here, where it tries to execute the literal alias "setUser($chan,$nick,1)" which doesn't exist.

2. As for your manual command, without 2 forward-slashes it types into channel that literal text.

It also types the text beginning with /w into channel instead of executing the /w alias, which you've never shown us whether it's a /notice or what it does. If you precede with 2 forward slashes but type that in status window, $chan is $null, and it tries to send a message to a nick named /w.

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
so /w is in aliases tab of remotes window? show us what it looks like.

Reminder that in aliases tab everything is like

/aliasname {
stuff
}

instead of
alias aliasname {
stuff
}

Joined: Jun 2014
Posts: 52
D
Babel fish
OP Offline
Babel fish
D
Joined: Jun 2014
Posts: 52
/w /whois $$1

That is how it appears in the aliases tab.

And all my aliases are fine as you can see. I have no idea why my writeini will not do anything? smirk

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
so now i finally see what you're calling a whisper.

a WHOIS is a message sent to the server to get the ip address and 'name' of a user. The person you do a /whois on - does not see the results of this, nor does not even know you're doing a /whois on them. The exception is that a small handful of server admins running the irc server are able to see when someone does a /whois on them.

Normally, the reply to "/whois nick" appears in status window, with the exception that if mirc-options/irc/show-in-active has a checkmark next to "whois", then the reply would show in your active channel.

As for your problem with notice being an invalid command, I noticed your answer showed you didn't paste my example, because my example used "test", but your answer used "hello" instead. Can you see if you still get the unknown command error if you use notice like this:

Code:
//notice $me TEST


Joined: Jun 2014
Posts: 52
D
Babel fish
OP Offline
Babel fish
D
Joined: Jun 2014
Posts: 52
I did exactly what you typed and it still says unknown command.

And still nobody has told me how to whisper someone with my bot? I have pasted my code. I have pointed to the relevant pieces of code: getUser setUser

This is very simple I thought?

Joined: Jan 2017
Posts: 57
Babel fish
Offline
Babel fish
Joined: Jan 2017
Posts: 57
Quote:
And still nobody has told me how to whisper someone with my bot?

If the goal is to send a Whisper over the Twitch Messaging Interface(TMI), then just send a normal chat message using the 'msg' command in mIRC.
Code:
msg #darthclide /w darthclide I whisper sweet nothings in your ear... er uh, beep boop, I'm a robot?

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
There's a difference between the getUser($chan,$nick) you used and

$getUser($chan,$nick)

Without the dollar, mIRC thinks you're trying to execute an alias name getUser($chan,$nick) without passing any parameters to it.


Unless there's something that twitch servers handle differently than mIRC, I can't see why an IRC server doesn't recognize NOTICE as a 'real' command that lets irc clients send non-query communications to each other, or why asking the server to do a /whois on someone would be related to whispering something to them.

I've been explaining things as if twitch were just an interest-group happening to also be using mirc. But from looking at a website describing the twitch interface, it appears that any advice you need related to your mirc's interaction with a twitch server might need to come from another twitch user. However, the reason why getUser($chan,$nick) without the dollar is a syntax error is an internal mirc issue that has nothing to do with using a twitch server or a standard server.

If you go somewhere like irc.freenode.net you'll see that "//notice $me test" is a real command. Whether it's also real at a twitch server is something else.

Joined: Jun 2014
Posts: 52
D
Babel fish
OP Offline
Babel fish
D
Joined: Jun 2014
Posts: 52
I took it most people used mirc with twitch (which is why I bought it originally), but I guess you just wrote a lot that just means "I have no idea why the notice command is doing that".

Here is the relevant code that should be working, but viewers report receiving no whispers. What could possibly be going wrong?

Code:
on *:join:#:{
  if ($nick != ignorednick) {
    var %here_before = $getUser($chan,$nick)
    var %setone = 1
    if (%here_before != 1 || %here_before == $null) {
      .msg /w $nick I am darthclide's bot, let me know if you received this whisper
      var %receive_return = $setUser($chan,$nick,%setone)
    }
  }
}

alias -l getUser {
  var %chan = $$1
  var %user = $$2
  var %boolvalue = $readini(UserList.ini,n,%chan,%user)

  if (%boolvalue == 1) {
    return %boolvalue
  }
  else {
    return 0
  }
}
alias -l setUser {
  var %chan = $1
  var %user = $2
  var %settrue = $3
  var %checkvalue = $readini(UserList.ini,n,%chan,%user)

  if (%checkvalue != 1 || %checkvalue == $null) {
    writeini -n UserList.ini %chan %user %settrue
    return %settrue
  }
}

Joined: Oct 2015
Posts: 112
B
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
I never bothered to learn how to script whispers with mIRC. SReject already did it and made his script available publicly. Simply install mTwitch.Core.mrc. You're done. You can now send and receive whispers using the standard IRC format of /msg. https://github.com/SReject/mTwitch

Joined: Jan 2017
Posts: 57
Babel fish
Offline
Babel fish
Joined: Jan 2017
Posts: 57
Quote:
What could possibly be going wrong?

I think the problem is the "on Join" bit.

I've never seen anyone else's name but that of my bot in the users list.
Try a small test code to at least make sure the whispers work, such as
Code:
on *:TEXT:!test:#: {
  msg $chan /w $nick This is an automated bounceback. Thanks for checking with me!
}

I think this is what you might be having trouble with, but as you can see, I'm not even one year old in mIRC. I'm just relaying the troubles I've had as a Twitch streamer.

Joined: Jan 2017
Posts: 57
Babel fish
Offline
Babel fish
Joined: Jan 2017
Posts: 57
I believe that what you are trying to do is somewhat similar to what I tried to do when I first started coding. When I realized that the "on Join" wasn't working for me, then I made this script to serve my purpose.
When I have something new I want to say, then I just type "!update 0.5 I added some stuff.", and the next time someone chats in my channel, it whispers them "Welcome to StreamBot v0.5! Changelog: I added some stuff."
Code:
on *:TEXT:!update*:#: {
  if ($nick == kuboskube) {
    set %Version $$2
    set %Changelog $$3-
  }
}

on *:TEXT:*:#: {
  if (%Version. [ $+ [ $nick ] ] != $null && %Version. [ $+ [ $nick ] ] == %Version) {
    goto VersionChecked
  }
  set %Version. [ $+ [ $nick ] ] %Version
  msg $chan /w $nick Welcome to StreamBot v [ $+ [ %Version ] $+ [ ! ] ] Changelog: %ChangeLog
  :VersionChecked
}

Joined: Jun 2014
Posts: 52
D
Babel fish
OP Offline
Babel fish
D
Joined: Jun 2014
Posts: 52
So you guys know, the code is activating just fine now. My UserList is updating correctly. So thankfully it is not an "on join" issue (but depending on what twitch does I might have to change it to "on text")

Joined: Jun 2014
Posts: 52
D
Babel fish
OP Offline
Babel fish
D
Joined: Jun 2014
Posts: 52
However, the whispers are still not working. But about SReject's code: You say that I can use /msg to send whispers, but that is the command I use to send messages globally for everyone to see in chat? And looking at the mTwitch.Core.mrc code, I do not see any alias anywhere called /msg What exactly does that code do? And how do I send whispers with it?

Joined: Oct 2015
Posts: 112
B
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
Originally Posted By: darthclide
However, the whispers are still not working. But about SReject's code: You say that I can use /msg to send whispers, but that is the command I use to send messages globally for everyone to see in chat? And looking at the mTwitch.Core.mrc code, I do not see any alias anywhere called /msg What exactly does that code do? And how do I send whispers with it?

You would just do:
Code:
/msg username message

Joined: Jun 2014
Posts: 52
D
Babel fish
OP Offline
Babel fish
D
Joined: Jun 2014
Posts: 52
So... Due to testing with KubosKube, we discovered we can only send whispers between our bots and ourselves. For example:
KubosKube <-> KubosKubot
darthclide <-> Darth_Bot

But whispers do not work for anyone else. Can you or anyone please tell me what hidden piece of mirc is causing this to happen?

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
As part of twitch's spam protection, by default, a user has to be following the user/bot for them to receive whispers that from that user/bot. That is: For UserA to receive whispers from UserB, UserA must be following UserB.

Users can toggle this in their setting: https://www.twitch.tv/settings/security

Last edited by FroggieDaFrog; 11/06/17 08:52 AM.

I am SReject
My Stuff
Joined: Jan 2017
Posts: 57
Babel fish
Offline
Babel fish
Joined: Jan 2017
Posts: 57
Hey Darthclide,
I signed my bot(KubosKubot) up for 2-Factor Auth, and some folks say that whispers can't be sent from a bot unless the bot is whispered first. Maybe that's our issue? Next time you're online, I'll whisper your bot and we'll see if that works. I only mention this because perhaps in our efforts to ensure our bots work(like a responsible coder should), perhaps we opened the figurative window on accident for our bots to send us whispers, and since we only need open the window once, we haven't noticed the "pattern".

I know this is a janky workaround, but any workaround is better than no workaround.

Joined: Jun 2014
Posts: 52
D
Babel fish
OP Offline
Babel fish
D
Joined: Jun 2014
Posts: 52
Hmmm, this is definitely not what I wanted. There has to be some mirc wizard who figured this out. If on twitch.tv I can send a whisper to a user I never wrote to before (as I proved true with Kubos), then there is absolutely no reason why a bot can't do the same.

If anyone wants to continue using my channel as a guinea pig, please do so. I want this experience to help others too.

Joined: Jan 2017
Posts: 57
Babel fish
Offline
Babel fish
Joined: Jan 2017
Posts: 57
The pattern other users devised was that Twitch does not allow IRC connections to open the figurative two-way door of whispers.

I feel as if the solution to our problem(making the bot speak first through a whisper), as much as we joked about it, may ironically be with sockets. sick

If a socket wizard could make a script to send a whisper in a more human way than IRC, then I'll bet Twitch would let it open a new whisper-chat as if by human.

Joined: Jun 2014
Posts: 52
D
Babel fish
OP Offline
Babel fish
D
Joined: Jun 2014
Posts: 52
It does indeed Kubos. If we can somehow fake twitch into thinking the bot is a human, then I think our problem is solved.

On a related note, I am sending 3 unique whispers one after another with my script. As long as I am not being raided, twitch won't ban me for sending 3 whispers at once will they? Or would it be a better idea to add a 1 second delay between each one?

Joined: Jun 2014
Posts: 52
D
Babel fish
OP Offline
Babel fish
D
Joined: Jun 2014
Posts: 52
So anybody out there who is a master with mirc want to help us out? I am sure somebody has the skills to help us get our whispers working properly.

Kubos is content with getting his bot to receive whispers, but I need my bot to send whispers. Both of us are curious about how to do this.

Joined: Jun 2014
Posts: 52
D
Babel fish
OP Offline
Babel fish
D
Joined: Jun 2014
Posts: 52
Still no takers for the challenge? I would be willing to pay a little money for someone who can figure this out.

Joined: Jul 2016
Posts: 28
Z
Ameglian cow
Offline
Ameglian cow
Z
Joined: Jul 2016
Posts: 28
Is this for Twitch? Because if it is for Twitch, please read the following https://discuss.dev.twitch.tv/t/have-a-chat-whisper-bot-let-us-know/10651

Last edited by zapdos26; 02/07/17 03:14 PM.
Page 1 of 2 1 2

Link Copied to Clipboard