lmariscal / twitchirc

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

[REQUEST]onhosted event #30

Closed NiD27 closed 6 years ago

NiD27 commented 6 years ago

basically streamer is channel S and if any random channel R.. so if R hosts S the on hosted function is called on the streamer side. ive seen this being done in java script but cant find it in java this is the code ive used before in javascript - https://gyazo.com/97f5e9b947972d7ef621d18713eacca4 PS this should help toooo the bot is acting as the streamer with the streamers oauth and stuff - https://gyazo.com/d3ddbaa2f4d98a95109a8ccd72bde0c4 could also use a 'on' function which listens to irc if it already exists pls lemme know couldnt find it

mvarendorff commented 6 years ago

Yep that is possible! I am currently working on it; I will comment again once I am done :)

NiD27 commented 6 years ago

@geisterfurz007 bro i really cant tell how amazing you are thanks sooooo much

mvarendorff commented 6 years ago

@NiD27 The code works and is tested. You can download the newest version of the TwitchBot.java on the branch "subpatch". That is the only required file to change for you. Or you backup your bot and download everything from that branch and put your stuff back in ^^

NiD27 commented 6 years ago

@geisterfurz007 thanks a lot mate cant tell how helpful you and this lib has been

NiD27 commented 6 years ago

@geisterfurz007 i have a question this function is called when someone hosts me right? or is it called when i host someone

mvarendorff commented 6 years ago

The method will be called whenever any channel the bot is in is hosted by any other channel out there. Which channel has been hosted is in the Channel object and who hosted is in the User object.

NiD27 commented 6 years ago

wow its even better than what i wanted thanks mate

mvarendorff commented 6 years ago

No problem! Hope it will serve you well ;)

NiD27 commented 6 years ago

ok i fully understand it now but since you did it using the pic i sent you at that time the code was logged in as the streamer and not as the bot so if anyone wants to run this they have to be logged in as the streamer

mvarendorff commented 6 years ago

Dangit, you are right. I thought it was a general message sent to the channel and not the particular user. I will have a look on that again tomorrow. Thanks for reporting! I will be busy tomorrow so it will probably only be fixed in the evening if at all :)

NiD27 commented 6 years ago

@geisterfurz007 last time i did research it was not possible but good luck anyways im sure i can get around it using multiple accounts and objects but yeah anyways let this version be in anyways it gets it done

mvarendorff commented 6 years ago

I am afraid, you are right. grafik NightDev created BetterTwitchTV as well so I guess they know what they say. Looks like this will not happen in a way that it is reported to public I guess. Sorry.

mvarendorff commented 6 years ago

The only idea that came to my mind just now would be adding something like a listener on a certain channel which would essentially be running a tiny bot that only has the onHost even and requires an oAuth token and username of the streamer as well as an action to perform. I am not sure how much traffic that would cause or whether that would be practical or not though.

mvarendorff commented 6 years ago

Another alternative would be polling the unofficial twitch chat API under tmi.twitch.tv as described here

NiD27 commented 6 years ago

@geisterfurz007 yeah i beat around it using the streamers oauth but not all streamers will be so willling to give out oauth

mvarendorff commented 6 years ago

The oauth token can only be used to connect to a socket (like this bot library does) and read the messages. It cannot be used as password or validation for anything else and can be revoked by them at any time (Settings -> Connections -> Forgot the name for the tool -> Revoke access; or something like that). And if your bot/the streamer using it wants the onhosted event, they have no other option (granted the feature is implemented).

NiD27 commented 6 years ago

ya the tmi or what ever tool i mean like you know if you dont really know that much about tech and you are about to send a weird gibbrish related to your account to a coder it kinda dont sound right but other than that it is safe i know that

mvarendorff commented 6 years ago

That is why you should explain it thoroughly to them in "normal" vocabulary. Something like "Without this unique code I cannot detect whether you have been hosted. What it does is giving me access to reading messages in chat including those that are exclusively for your eyes as well (such as whisper and someone hosting you). I cannot use it to login to your account or similar things." (In theory you can as well send messages under their name with that which is something you might want to mention as well). If they want that feature, they have to trust you. If they don't, that is not your issue!

mvarendorff commented 6 years ago

Currently I am working fulltime but from 5-th of March I am back in college and will have more time to implement both listeners (polling and the option if you have their credentials) but as said, that will take some time until I will get onto it. Closing this for now.

lmariscal commented 6 years ago

42 added onHost event