summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2022-05-08 00:27:48 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2022-05-08 00:27:48 -0400
commit3b5f4ded3155c98e346b5b312ae943f9894fae7a (patch)
tree8226e3a484661ef991ec61a1e25ad71e94b788d2
parentf6fdfeb95fd1042cdf6b33a3b82026d6d4723826 (diff)
downloadabaddon-portaudio-3b5f4ded3155c98e346b5b312ae943f9894fae7a.tar.gz
abaddon-portaudio-3b5f4ded3155c98e346b5b312ae943f9894fae7a.zip
stop sending messages to inaccessible channels
-rw-r--r--src/abaddon.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/abaddon.cpp b/src/abaddon.cpp
index fe37251..6dda3f5 100644
--- a/src/abaddon.cpp
+++ b/src/abaddon.cpp
@@ -696,6 +696,10 @@ void Abaddon::ActionChatLoadHistory(Snowflake id) {
void Abaddon::ActionChatInputSubmit(std::string msg, Snowflake channel, Snowflake referenced_message) {
if (msg.substr(0, 7) == "/shrug " || msg == "/shrug")
msg = msg.substr(6) + "\xC2\xAF\x5C\x5F\x28\xE3\x83\x84\x29\x5F\x2F\xC2\xAF"; // this is important
+
+ if (!channel.IsValid()) return;
+ if (!m_discord.HasChannelPermission(m_discord.GetUserData().ID, channel, Permission::VIEW_CHANNEL)) return;
+
if (referenced_message.IsValid())
m_discord.SendChatMessage(msg, channel, referenced_message);
else