Valgorithms / Palace-Revived

ValZarGaming's offical Discord bot built in ReactPHP.
1 stars 1 forks source link

Twitch User Verification #3

Open valzargaming opened 1 year ago

valzargaming commented 1 year ago

This enhancement intends to capture user information from Twitch as it appears in a streamer's live steam chat. It would do so by counting the number of times a user has sent a message in a streamer's channel and save this information to a single json file so it may be retrieved again at a later time.

This system would allow new users to get a @Verified role in Discord if: a) The Discord server owner has set up a relay channel and added at least one stream channel to their bot's configuration (see https://github.com/VZGCoders/Palace-Revived/blob/e5edb941233ca98a0309b6c8289526fa1eaa7306/run.php#L125) b) The Twitch account has sent X amount of relayed messages in the twitch stream chat. (The bot will keep count per-channel and per-user using an associative array) c) The Discord user uses a command asking to be verified (probably something like @Tutelar twitchverify my_username_here and copies a similar command to the twitch chat to prove they own the account (probably something like @Tutelar verifytoken some_generated_token (This is similar to how our Space Station 13 bots work right now, except now we'll be supporting Twitch) OR d) The Discord user has a Twitch profile connected to their Discord and authorizes the bot to access their Twitch profile via oauth2, which it will then do the same steps as above but without the need for additional twitchverify/verifytoken/etc commands. (I'm currently tentative on this one for privacy and security reasons)

valzargaming commented 1 year ago

I started working on the code for this inside of the $twitch_relay variable function but it's currently in an unfinished state and doesn't seem to actually save anything to a json file yet. https://github.com/VZGCoders/Palace-Revived/blob/main/variable_functions.php#L353

valzargaming commented 1 year ago

Logging twitch users by their message count sorted by streamer has been implemented as of commit 7e83cb3560aee74510cad8d5316a49441c0ac113 The only thing left to do is to allow user verification within servers that have a configuration set as shown above.

valzargaming commented 1 year ago

Updated this to sort activity by Discord server ID so as to avoid potentially gaming the system by adding the bot to several discord servers and following the same channel to inflate the total message count per user.