Twitch SDK (Internal)
chaterrortypes.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) 2012-2016 Twitch Interactive, Inc.
7 *********************************************************************************************/
8 
9 #pragma once
10 
12 
13 #include <vector>
14 
18 const uint32_t TTV_MODULE_ID_TWITCH_CHAT = 1;
19 
20 
21 #define TTV_CHAT_ERROR_IDS\
22  /* Warnings */\
23  BEGIN_WARNING_IDS(TTV_WRN_CHAT_BEGIN_WARNINGS)\
24  USE_TTV_WARNING_ID(TTV_WRN_CHAT_MESSAGE_SPAM_DISCARDED) \
25  END_WARNING_IDS(TTV_WRN_CHAT_END_WARNINGS)\
26  \
27  /* Errors */\
28  BEGIN_ERROR_IDS(TTV_EC_CHAT_BEGIN_ERRORS)\
29  USE_TTV_ERROR_ID(TTV_EC_CHAT_NO_HOSTS) \
30  USE_TTV_ERROR_ID(TTV_EC_CHAT_ALREADY_IN_CHANNEL) \
31  USE_TTV_ERROR_ID(TTV_EC_CHAT_LOST_CONNECTION) \
32  USE_TTV_ERROR_ID(TTV_EC_CHAT_COULD_NOT_CONNECT) \
33  USE_TTV_ERROR_ID(TTV_EC_CHAT_NOT_IN_CHANNEL) \
34  USE_TTV_ERROR_ID(TTV_EC_CHAT_INVALID_MESSAGE) \
35  USE_TTV_ERROR_ID(TTV_EC_CHAT_TOO_MANY_REQUESTS) \
36  USE_TTV_ERROR_ID(TTV_EC_CHAT_LEAVING_CHANNEL) \
37  USE_TTV_ERROR_ID(TTV_EC_CHAT_ANON_DENIED) \
38  USE_TTV_ERROR_ID(TTV_EC_CHAT_RESTRICTED) \
39  USE_TTV_ERROR_ID(TTV_EC_CHAT_EMOTICON_DATA_NOT_READY) \
40  USE_TTV_ERROR_ID(TTV_EC_CHAT_EMOTICON_DATA_DOWNLOADING) \
41  USE_TTV_ERROR_ID(TTV_EC_CHAT_EMOTICON_DATA_LOCKED) \
42  USE_TTV_ERROR_ID(TTV_EC_CHAT_EMOTICON_DOWNLOAD_FAILED) \
43  USE_TTV_ERROR_ID(TTV_EC_CHAT_INVALID_CHAT_THREAD_ID) \
44  USE_TTV_ERROR_ID(TTV_EC_CHAT_INVALID_CHAT_MESSAGE_ID) \
45  END_ERROR_IDS(TTV_EC_CHAT_END_ERRORS)\
46 
47 #define USE_TTV_ERROR_ID(ec) ec,
48 #define USE_TTV_WARNING_ID(ec) ec,
49 #define USE_TTV_SUCCESS_ID(ec) ec = 0,
50 #define BEGIN_WARNING_IDS(ec) ec = CONSTRUCT_WARNING_ID_VALUE(TTV_MODULE_ID_TWITCH_CHAT, (1 << 12)),
51 #define END_WARNING_IDS(ec) ec,
52 #define BEGIN_ERROR_IDS(ec) ec = CONSTRUCT_ERROR_ID_VALUE(TTV_MODULE_ID_TWITCH_CHAT, 1),
53 #define END_ERROR_IDS(ec) ec
54 
58 typedef enum
59 {
61 
63 
64 #undef BEGIN_ERROR_IDS
65 #undef END_ERROR_IDS
66 #undef BEGIN_WARNING_IDS
67 #undef END_WARNING_IDS
68 #undef USE_TTV_SUCCESS_ID
69 #undef USE_TTV_WARNING_ID
70 #undef USE_TTV_ERROR_ID
71 
72 
73 namespace ttv
74 {
75  namespace chat
76  {
80  const char* ChatErrorToString(TTV_ErrorCode ec);
81 
82  void GetChatErrorCodeValues(std::vector<EnumValue>& result);
83 
84 
85  enum class GraphQLErrorCode
86  {
87  SUCCESS,
88  UNKNOWN,
93  FORBIDDEN,
111  TARGET_IS_MOD,
123  };
124 
126  {
128 
132  };
133 
135  {
136  CreateRoomError();
137 
139  uint32_t maxAllowedRooms;
140  uint32_t minLength;
141  uint32_t maxLength;
142  };
143 
145  {
146  UpdateRoomError();
147 
149  uint32_t minLength;
150  uint32_t maxLength;
151  };
152 
154  {
156 
160  };
161 
163  {
164  BanUserError();
165 
167  };
168 
170  {
171  UnbanUserError();
172 
174  };
175 
177  {
178  ModUserError();
179 
181  };
182 
184  {
185  UnmodUserError();
186 
188  };
189  }
190 }
Definition: chaterrortypes.h:125
uint32_t minLength
On NAME_LENGTH_INVALID, TOPIC_LENGTH_INVALID, minimum number of characters.
Definition: chaterrortypes.h:140
User tried to ban moderator without permission. banUser.
Received an unrecognized error code.
Target channel does not exist. modUser, unmodUser.
Target is not banned in channel. unbanUser.
User tried to ban admin. banUser.
User is timed out from the channel sendRoomMessage.
uint32_t maxAllowedRooms
On MAX_ROOMS_LIMIT_EXCEEDED, max number of rooms user can create.
Definition: chaterrortypes.h:139
Definition: chaterrortypes.h:153
Room is in slow mode and user tried to send a message too quickly. sendRoomMessage.
Definition: chaterrortypes.h:162
Definition: chaterrortypes.h:134
Target is already a mod. modUser.
uint32_t slowModeDurationSeconds
On SLOW_MODE_ENFORCEMENT_FAILED, number of seconds a user must wait between sending messages...
Definition: chaterrortypes.h:130
User tried to ban themselves. banUser.
#define TTV_CHAT_ERROR_IDS
Definition: chaterrortypes.h:21
uint32_t remainingDurationSeconds
On SLOW_MODE_ENFORCMENT_FAILED, USER_CHAT_TIMED_OUT, the number of remaining seconds a user must wait...
Definition: chaterrortypes.h:131
Name failed automod check. createRoom, updateRoom.
Topic is too short or too long. createRoom, updateRoom.
User tried to ban admin. banUser.
Duration provided was too short or too long. banUser.
GraphQLErrorCode code
Code describing the error.
Definition: chaterrortypes.h:166
Topic failed automod check. createRoom, updateRoom.
GraphQLErrorCode code
Code describing the error.
Definition: chaterrortypes.h:187
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
Message contained zalgo characters. sendRoomMessage.
GraphQLErrorCode code
Code describing the error.
Definition: chaterrortypes.h:157
GraphQLErrorCode code
Code describing the error.
Definition: chaterrortypes.h:180
GraphQLErrorCode code
Code describing the error.
Definition: chaterrortypes.h:173
Target does not exist. banUser, unbanUser, modUser, unmodUser.
uint32_t maxLength
On NAME_LENGTH_INVALID, TOPIC_LENGTH_INVALID, maximum number of characters.
Definition: chaterrortypes.h:141
User tried to ban anonymous user. banUser.
Name contains invalid characters (e.g. spaces). createRoom, updateRoom.
Room is in R9K mode and message was not unique. sendRoomMessage.
uint32_t maximumSlowModeDurationSeconds
On SLOW_MODE_DURATION_INVALID, maximum number of seconds slow mode can be set to. ...
Definition: chaterrortypes.h:159
User is not allowed to perform the action.
Target is not a mod. unmodUser.
Could not find a room with the given room ID. updateRoom. updateRoomModes.
Room is in emotes only mode and message contained non-emote text. sendRoomMessage.
GraphQLErrorCode code
Code describing the error.
Definition: chaterrortypes.h:129
Definition: chaterrortypes.h:169
User is rate limited. sendRoomMessage.
Message failed spam check. sendRoomMessage.
uint32_t TTV_ErrorCode
Definition: errortypes.h:30
void GetChatErrorCodeValues(std::vector< EnumValue > &result)
const uint32_t TTV_MODULE_ID_TWITCH_CHAT
Definition: chaterrortypes.h:18
Name is too short or too long. createRoom, updateRoom.
Slow mode duration was too short, too long, or not a number. updateRoomModes.
User tried to ban broadcaster. banUser.
const char * ChatErrorToString(TTV_ErrorCode ec)
GraphQLErrorCode code
Code describing the error.
Definition: chaterrortypes.h:148
User is banned from the channel. sendRoomMessage.
Definition: chaterrortypes.h:144
User is banned from chat. modUser.
GraphQLErrorCode code
Code describing the error.
Definition: chaterrortypes.h:138
TTV_ChatErrorId
Definition: chaterrortypes.h:58
uint32_t maxLength
On NAME_LENGTH_INVALID, TOPIC_LENGTH_INVALID, maximum number of characters.
Definition: chaterrortypes.h:150
GraphQLErrorCode
Definition: chaterrortypes.h:85
User tried to ban staff. banUser.
User cannot create any more rooms. createRoom.
uint32_t minimumSlowModeDurationSeconds
On SLOW_MODE_DURATION_INVALID, minimum number of seconds slow mode can be set to. ...
Definition: chaterrortypes.h:158
User tried to ban already banned user. banUser.
Message failed automod check. sendRoomMessage.
Definition: chaterrortypes.h:183
User is suspended from Twitch. sendRoomMessage.
Definition: chaterrortypes.h:176
uint32_t minLength
On NAME_LENGTH_INVALID, TOPIC_LENGTH_INVALID, minimum number of characters.
Definition: chaterrortypes.h:149