-
-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add initial EventSub Helix support #4962
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
6e550ff
to
5f4fbe8
Compare
5f4fbe8
to
0beaafe
Compare
d23415b
to
cb78caa
Compare
this isn't a submodule yet xd
downside is it's broadcaster only, so it's not a good replacement yet
Co-authored-by: Wissididom <30803034+Wissididom@users.noreply.github.com>
cb78caa
to
2db096d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 25 out of 27. Check the log or trigger a new build to see more.
src/common/ChannelChatters.cpp
Outdated
@@ -89,7 +89,7 @@ size_t ChannelChatters::colorsSize() const | |||
return size; | |||
} | |||
|
|||
const QColor ChannelChatters::getUserColor(const QString &user) | |||
const QColor ChannelChatters::getUserColor(const QString &user) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: return type 'const QColor' is 'const'-qualified at the top level, which may reduce code readability without improving const correctness [readability-const-return-type]
const QColor ChannelChatters::getUserColor(const QString &user) const | |
QColor ChannelChatters::getUserColor(const QString &user) const |
src/common/ChannelChatters.hpp:26:
- const QColor getUserColor(const QString &user) const;
+ QColor getUserColor(const QString &user) const;
}); | ||
} | ||
|
||
void onNotification(eventsub::messages::Metadata metadata, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: method 'onNotification' can be made static [readability-convert-member-functions-to-static]
void onNotification(eventsub::messages::Metadata metadata, | |
static void onNotification(eventsub::messages::Metadata metadata, |
using namespace chatterino; | ||
using namespace std::chrono_literals; | ||
|
||
const QString regexHelpString("(\\w+)[.,!?;:]*?$"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: invalid case style for global constant 'regexHelpString' [readability-identifier-naming]
const QString regexHelpString("(\\w+)[.,!?;:]*?$"); | |
const QString REGEX_HELP_STRING("(\\w+)[.,!?;:]*?$"); |
src/providers/twitch/EventSubMessageBuilder.cpp:58:
- const QRegularExpression mentionRegex("^@" + regexHelpString);
+ const QRegularExpression mentionRegex("^@" + REGEX_HELP_STRING);
src/providers/twitch/EventSubMessageBuilder.cpp:61:
- const QRegularExpression allUsernamesMentionRegex("^" + regexHelpString);
+ const QRegularExpression allUsernamesMentionRegex("^" + REGEX_HELP_STRING);
const QString regexHelpString("(\\w+)[.,!?;:]*?$"); | ||
|
||
// matches a mention with punctuation at the end, like "@username," or "@username!!!" where capture group would return "username" | ||
const QRegularExpression mentionRegex("^@" + regexHelpString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: invalid case style for global constant 'mentionRegex' [readability-identifier-naming]
const QRegularExpression mentionRegex("^@" + regexHelpString); | |
const QRegularExpression MENTION_REGEX("^@" + regexHelpString); |
src/providers/twitch/EventSubMessageBuilder.cpp:429:
- auto match = mentionRegex.match(string);
+ auto match = MENTION_REGEX.match(string);
// Need to remove EmoteElement and replace with LayeredEmoteElement | ||
auto baseEmoteElement = this->releaseBack(); | ||
|
||
std::vector<LayeredEmoteElement::Emote> layers = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'layers' is not initialized [cppcoreguidelines-init-variables]
std::vector<LayeredEmoteElement::Emote> layers = { | |
std::vector<LayeredEmoteElement::Emote> layers = 0 = { |
return Failure; | ||
} | ||
|
||
std::optional<EmotePtr> EventSubMessageBuilder::getTwitchBadge( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: method 'getTwitchBadge' can be made static [readability-convert-member-functions-to-static]
src/providers/twitch/EventSubMessageBuilder.hpp:63:
- std::optional<EmotePtr> getTwitchBadge(const Badge &badge) const;
+ static std::optional<EmotePtr> getTwitchBadge(const Badge &badge) ;
src/providers/twitch/EventSubMessageBuilder.cpp:1010:
- const Badge &badge) const
+ const Badge &badge)
} | ||
} | ||
|
||
Outcome EventSubMessageBuilder::tryParseCheermote(const QString &string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: function 'tryParseCheermote' is within a recursive call chain [misc-no-recursion]
^
Additional context
src/providers/twitch/EventSubMessageBuilder.cpp:1232: example recursive call chain, starting from function 'tryParseCheermote'
^
src/providers/twitch/EventSubMessageBuilder.cpp:1294: Frame #1: function 'tryParseCheermote' calls function 'tryParseCheermote' here:
);
^
src/providers/twitch/EventSubMessageBuilder.cpp:1294: ... which was the starting point of the recursive call chain; there may be other cycles
);
^
return true; | ||
} | ||
|
||
void EventSubMessageBuilder::setThread(std::shared_ptr<MessageThread> thread) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the parameter 'thread' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
src/providers/twitch/EventSubMessageBuilder.hpp:51:
- void setThread(std::shared_ptr<MessageThread> thread);
+ void setThread(const std::shared_ptr<MessageThread>& thread);
void EventSubMessageBuilder::setThread(std::shared_ptr<MessageThread> thread) | |
const & |
this->thread_ = std::move(thread); | ||
} | ||
|
||
void EventSubMessageBuilder::setParent(MessagePtr parent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the parameter 'parent' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
src/providers/twitch/EventSubMessageBuilder.hpp:52:
- void setParent(MessagePtr parent);
+ void setParent(const MessagePtr& parent);
void EventSubMessageBuilder::setParent(MessagePtr parent) | |
const & |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
struct ChannelPointReward; | ||
struct DeleteAction; | ||
|
||
class EventSubMessageBuilder : MessageBuilder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: class 'EventSubMessageBuilder' defines a default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions]
class EventSubMessageBuilder : MessageBuilder
^
|
||
void addWords(); | ||
void addTextOrEmoji(EmotePtr emote) override; | ||
void addTextOrEmoji(const QString &value) override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: function 'chatterino::EventSubMessageBuilder::addTextOrEmoji' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]
void addTextOrEmoji(const QString &value) override;
^
Additional context
src/providers/twitch/EventSubMessageBuilder.cpp:400: the definition seen here
void EventSubMessageBuilder::addTextOrEmoji(const QString &string_)
^
src/providers/twitch/EventSubMessageBuilder.hpp:68: differing parameters are named here: ('value'), in definition: ('string_')
void addTextOrEmoji(const QString &value) override;
^
Co-Authored-By: nerix <nero.9@hotmail.de>
* fix(eventsub): support all compilers and stuff * fix: awaitable * fix: qualify `value_to` This is the run
Description
This PR is expected to fail in CI - to build locally you need to have the
https://github.com/pajlada/beast-websocket-client
repo cloned in the same dir as your c2 repo is cloned.I will include this as a submodule once this PR is ready to be merged in.