Twitch SDK (Internal)
chatroommessagehandler.h
Go to the documentation of this file.
1 /********************************************************************************************
2  * Twitch Broadcasting SDK
3  *
4  * This software is supplied under the terms of a license agreement with Twitch Interactive, Inc. and
5  * may not be copied or used except in accordance with the terms of that agreement
6  * Copyright (c) 2017 Twitch Interactive, Inc.
7  *********************************************************************************************/
8 
9 #pragma once
10 
12 
13 namespace ttv
14 {
15  namespace chat
16  {
17  class ChatRoomMessageHandler;
18  }
19 }
20 
27 {
28 public:
29 
33  enum class CommandError
34  {
35  Ban,
36  Unban,
37  Timeout,
38  Untimeout,
39  Mod,
40  Unmod,
41  Color,
42  Topic,
43  Slow,
44  Me
45  };
46 
51  class ICallbacks
52  {
53  public:
54  virtual ~ICallbacks() = default;
55 
63  virtual bool PassThrough(const std::string& message) = 0;
64 
72  virtual bool BanUser(const std::string& userName) = 0;
73 
81  virtual bool UnbanUser(const std::string& userName) = 0;
82 
91  virtual bool TimeoutUser(const std::string& userName, uint32_t duration) = 0;
92 
100  virtual bool UntimeoutUser(const std::string& userName) = 0;
101 
109  virtual bool SetUserColor(const std::string& color) = 0;
110 
117  virtual bool Help() = 0;
118 
125  virtual bool ListRooms() = 0;
126 
134  virtual bool ModUser(const std::string& userName) = 0;
135 
143  virtual bool UnmodUser(const std::string& userName) = 0;
144 
151  virtual bool ListModerators() = 0;
152 
160  virtual bool SetTopic(const std::string& topic) = 0;
161 
170  virtual bool SlowMode(bool turnOn, uint32_t durationSeconds) = 0;
171 
179  virtual bool R9kMode(bool turnOn) = 0;
180 
188  virtual bool EmotesOnlyMode(bool turnOn) = 0;
189 
196  virtual bool MalformedCommand(CommandError command) = 0;
197  };
198 
200 
208  bool HandleMessage(const std::string& message);
209 
215  void SetCallbacks(const std::shared_ptr<ICallbacks>& callbacks) { mCallbacks = callbacks; }
216 
217 private:
218  std::shared_ptr<ICallbacks> mCallbacks;
219 };
bool HandleMessage(const std::string &message)
Definition: chatroommessagehandler.h:51
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
Definition: chatroommessagehandler.h:26
void SetCallbacks(const std::shared_ptr< ICallbacks > &callbacks)
Definition: chatroommessagehandler.h:215
std::shared_ptr< ICallbacks > mCallbacks
Definition: chatroommessagehandler.h:218
CommandError
Definition: chatroommessagehandler.h:33