lmariscal / twitchirc

Twitch Bot Development made Easier | DEPRECATED
Other
40 stars 15 forks source link

Whisper not sending? #22

Closed kayc01 closed 7 years ago

kayc01 commented 7 years ago

Hey, So I sent a whisper via console and it was not appearing on twitch but showed in console.

Console Output: MSG #swiftor : /w kayc01 kayc01, you have started a Transfer Gamble, kayc01 you have 30 seconds to transfer me the exact same amount. Copy and Paste this in chat: !transfer abkayckay 1000

Which looks fine, however no Whisper was actually sent or received on the website.

Code: this.whisper(user, user+", you have started a Transfer Gamble, "+ user +" you have 30 seconds to transfer me the exact same amount. Copy and Paste this in chat: !transfer abkayckay " + df2.format(amountTransfered));

lmariscal commented 7 years ago

If you are not using the last release of the bot the was a typo in the whisper function. It was fixed in the last release

kayc01 commented 7 years ago

I am using TwitchIRC v1.2.jar which is the latest :/ It's also in my Bot Class with all the onMessage events etc...

Everything seems formatted correctly in the output and its sending it via console but not via website/twitch.

mvarendorff commented 7 years ago

I am only able to recreate the problem when I have the bot join a channel that is not a username on Twitch (so for example an empty channel name (which will then be the channel #) or a very long username) as the first channel it joins. I have tested it on port 80 as well as 443 and 667 and could not recreate the problem in any other way eventhough I checked and swiftor has a channel (a decently big one as well).

Everything else works properly (poor hope on the side of mine that the connection is somehow not established)?

kayc01 commented 7 years ago

I don't know, is there anything else I need to do for using Whispers? I have not messed with any ports or anything. Literally only using whisper(user, string);.

I can try restart the bot however other parts are working just fine. The whispers are being ran, just not actually executing anything on twitch's side.

Any further idea's appreciated.

mvarendorff commented 7 years ago

Only things you would have to do for everything else as well... Create a bot, connect it, join a channel and you should be good to go...

I have my main method (in Main.class) here:

public static void main(String[] args) {
    TestBot bot = new TestBot();
    bot.connect();
    bot.joinChannel("swiftor");
    bot.whisper(User.getUser("geisterfurz007"), "kayc01, you have started a Transfer Gamble, kayc01 you have 30 seconds to transfer me the exact same amount. Copy and Paste this in chat: !transfer abkayckay 1000");
    bot.start();
}

and my onWhisper (in my TestBot.class) here:

protected void onWhisper(User user, String message) {
    this.whisper(user, message);
}

to see what was whispered.

Doing that I am correctly beeing whispered the above String...

And the console message is:

MSG #swiftor : /w geisterfurz007 kayc01, you have started a Transfer Gamble, kayc01 you have 30 seconds to transfer me the exact same amount. Copy and Paste this in chat: !transfer abkayckay 1000

kayc01 commented 7 years ago

I can whisper via my version of TestBot.class right? Using this.whisper in CkayBot.class instead of bot.whisper in Main.class?

Have no way of making it whisper at the correct time if not. I currently do not also use onWhisper as I do not need to read whispers.

mvarendorff commented 7 years ago

Yes using this.whisper should work as well.

To make sure I tested it by triggering the whispering once after I connected the bot and once after I received a certain message.

kayc01 commented 7 years ago

Odd. Idk why its not working :( Ill try restart and stuff later.

mvarendorff commented 7 years ago

Yeah I have no clue currently either, sorry. Best advice I can give is to copy your project and take out things you do not think are causing the problem until you are down to a very short sample that you can then paste on some paste site and link it here or until the problem no longer persists.

If the latter happens, you can then share the piece of code that was causing the problem and I will work on that.

lmariscal commented 7 years ago

This bot is using the chat whispering method to save connections, in order to use the whispers you need to join at least one channel,

kayc01 commented 7 years ago

It does join a channel, it joins it in the main and then stays in it whilst betting is going on. Like the bot is doing other stuff whilst the whisper is not being sent. So its in the swiftor channel all the time its running.

It also re-joins during some run methods to get the channel instance in that enclosed scope.

kayc01 commented 7 years ago

Problem is @geisterfurz007 there are no problems. Other than the whispers not being sent. They come through console but don't actually appear. Like its either a format issue in the whisper yet it looks fine.

lmariscal commented 7 years ago

I reformat the whisper in the las commit but I have being using the lib for a personal bot and have not experienced any problems. And have been using whispers heavily

kayc01 commented 7 years ago

I did exactly what @geisterfurz007 did:

CkayBotClass bot = new CkayBotClass(); bot.connect(); bot.joinChannel("swiftor"); bot.whisper(User.getUser("kayc01"), "test."); bot.start();

The whisper never gets sent. Any idea on what I can mess with? this.setWhisperIP(IP, Port); And if so, what should I enter into IP? Ill try the 3 ports you mentioned earlier.

Thanks

Squidkingdom commented 7 years ago

whisperIp and Port are unused You might try eclipse's /NetBeans debug mode and look very closely at everything

On Jun 24, 2017, at 6:29 PM, kayc01 notifications@github.com wrote:

I did exactly what @geisterfurz007 did:

CkayBotClass bot = new CkayBotClass(); bot.connect(); bot.joinChannel("swiftor"); bot.whisper(User.getUser("kayc01"), "test."); bot.start();

The whisper never gets sent. Any idea on what I can mess with? this.setWhisperIP(IP, Port); And if so, what should I enter into IP? Ill try the 3 ports you mentioned earlier.

Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

lmariscal commented 7 years ago

The lib isn't using a different connection for whispers if you can send a chat message you should be able to send a whisper. Check if the user you are trying to send a whisper is has the whispers enabled

Squidkingdom commented 7 years ago

Yep, If i remember correctly whisper() just calls sendMessage() in the library. Try just doing sendMessage("/w "+user+" This is a message", channel)

kayc01 commented 7 years ago

@Squidkingdom still doing nothing even so :/ what the heck.

Squidkingdom commented 7 years ago

ummmm..... the only thing i can think of is to copy and paste the code from sendMessage() and try that. I cant give you that ATm because im on mobile but i sure @geisterfurz007 or @cavariux can get that

mvarendorff commented 7 years ago

I am curious... What if you did sendMessage(".w "+user+" This is a message", channel) ? The dot has been intentional by me when I initially wrote the whisper part, though I am unsure if it actually caused issues somewhere I did not expect. Reason for that is that twitch understands a . in the beginning as a / as well though I am unsure if that might cause a difference for your issue. Both with a colon and a slash work fine for me.

lmariscal commented 7 years ago

@geisterfurz007 That's why I changed that part in the last release. And yeah Twitch wasn't recognizing . as / but I changed so it shouldn't be a problem.

mvarendorff commented 7 years ago

For me it does which was the reason I did that. Right now I am wondering if we all connect to different servers that treat this thing differently.

lmariscal commented 7 years ago

@geisterfurz007 that could be an issue. But the lib is correct I have been heavily using it for development lately and have had no problems.

kayc01 commented 7 years ago

@geisterfurz007 nope didn't do anything :/

Just to confirm, I can manually whisper on both accounts to each other via the website. Just not via the bot. So yes Whispers are enabled.

Then, the sendMessage(/w and sendMessage(.w are both not doing anything.

Squidkingdom commented 7 years ago

can you copy paste that section of code

kayc01 commented 7 years ago

@Squidkingdom this.whisper(User.getUser("kayc01"), "test."); this.sendMessage(".w kayc01 test2", channel); this.sendMessage("/w kayc01 test2", channel);

All 3 do nothing, this is just triggered when I put "Kappa" in chat as a test. I use it as my debug command to check Booleans and stuff so that should not matter.

Squidkingdom commented 7 years ago

Make sure the bot is mod, if not add Thread.sleep(1500); In-between Each message and try removing the "This."

Sincerely, Squid

On Jun 25, 2017, at 8:37 AM, kayc01 notifications@github.com wrote:

@Squidkingdom this.whisper(User.getUser("kayc01"), "test."); this.sendMessage(".w kayc01 test2", channel); this.sendMessage("/w kayc01 test2", channel);

All 3 do nothing, this is just triggered when I put "Kappa" in chat as a test. I use it as my debug command to check Booleans and stuff so that should not matter.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

kayc01 commented 7 years ago

Removing this. fixed it. Thank you.

Squidkingdom commented 7 years ago

Good! Anytime man!