diff --git a/GSChaos/CChaos.cpp b/GSChaos/CChaos.cpp index 3eb4c836..760349db 100644 --- a/GSChaos/CChaos.cpp +++ b/GSChaos/CChaos.cpp @@ -164,19 +164,22 @@ void CChaos::Vote(const std::string& user, const std::string& msg) return; } - // TODO: rename voting commands - if (msg.find("effect1") != std::string::npos) - voteValue = 0; - else if (msg.find("effect2") != std::string::npos) - voteValue = 1; - else if (msg.find("effect3") != std::string::npos) - voteValue = 2; - - if (voteValue != -1) + if (msg.size() == 1 && std::isdigit(msg[0])) { - m_twitchVoters.push_back({ user, voteValue }); - m_aiVoteValues[voteValue]++; - DEBUG_PRINT("Twitch user %s voted for option %i\n", user.c_str(), voteValue + 1); + voteValue = std::stoi(msg); + if (voteValue >= 1 && voteValue <= 3) + { + m_twitchVoters.push_back({ user, voteValue - 1 }); + m_aiVoteValues[voteValue - 1]++; + DEBUG_PRINT("Twitch user %s voted for option %i\n", user.c_str(), voteValue); + } + else + { + DEBUG_PRINT("Invalid vote value: %i\n", voteValue); + } + } + else { + DEBUG_PRINT("Invalid vote message: %s\n", msg.c_str()); } } diff --git a/GSChaos/CFeatureNothing.h b/GSChaos/CFeatureNothing.h index 9b763a50..429513c4 100644 --- a/GSChaos/CFeatureNothing.h +++ b/GSChaos/CFeatureNothing.h @@ -1,8 +1,8 @@ /** * Copyright - ScriptedSnark, 2024. - * CFeatureNothing.h - description + * CFeatureNothing.h * - * Project (Project desc) header file + * Project (GSChaos) header file * Authors: ScriptedSnark. * Do not delete this comment block. Respect others' work! */ diff --git a/README.md b/README.md index bbb6ee74..63564a55 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ GSChaos supports Twitch chat voting. If you want to use it, then do some steps: 7. Run the game and check if everything is installed successfully (wait for 10 seconds in game after chaos bar activating so you can check voting system) -To vote, you need to type `effectNUMBER` in chat (for example, `effect2`). +To vote, you need to type `NUMBER` in chat (for example, `2`). If you don't want to play with this feature, rename `twitch.ini` to `twitch_DISABLED.ini`. ## Effects