discord-connector.inc 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. /* Discord Connector
  2. * Version v0.3.5
  3. * made by maddinat0r
  4. */
  5. #if defined dcconnector_included
  6. #endinput
  7. #endif
  8. #define dcconnector_included
  9. enum DCC_ChannelType
  10. {
  11. GUILD_TEXT = 0,
  12. DM = 1,
  13. GUILD_VOICE = 2,
  14. GROUP_DM = 3,
  15. GUILD_CATEGORY = 4
  16. };
  17. enum DCC_UserPresenceStatus
  18. {
  19. INVALID = 0,
  20. ONLINE = 1,
  21. IDLE = 2,
  22. DO_NOT_DISTURB = 3,
  23. OFFLINE = 4
  24. };
  25. enum DCC_BotPresenceStatus
  26. {
  27. INVALID = 0,
  28. ONLINE,
  29. IDLE,
  30. DO_NOT_DISTURB,
  31. INVISIBLE,
  32. OFFLINE
  33. };
  34. enum DCC_MessageReactionType
  35. {
  36. REACTION_ADD = 0, // Sent when a user adds a reaction to a message.
  37. REACTION_REMOVE, // Sent when a user removes a reaction from a message.
  38. REACTION_REMOVE_ALL, // Sent when a user explicitly removes all reactions from a message.
  39. REACTION_REMOVE_EMOJI // Sent when a bot removes all instances of a given emoji from the reactions of a message.
  40. };
  41. #define DCC_INVALID_CHANNEL DCC_Channel:0
  42. #define DCC_INVALID_USER DCC_User:0
  43. #define DCC_INVALID_ROLE DCC_Role:0
  44. #define DCC_INVALID_GUILD DCC_Guild:0
  45. #define DCC_ID_SIZE (20 + 1)
  46. #define DCC_USERNAME_SIZE (32 + 1)
  47. #define DCC_NICKNAME_SIZE (32 + 1)
  48. #define DCC_EMOJI_NAME_SIZE (32 + 1)
  49. // natives
  50. // channels
  51. native DCC_Channel:DCC_FindChannelByName(const channel_name[]);
  52. native DCC_Channel:DCC_FindChannelById(const channel_id[]);
  53. native DCC_GetChannelId(DCC_Channel:channel, dest[DCC_ID_SIZE], max_size = sizeof dest);
  54. native DCC_GetChannelType(DCC_Channel:channel, &DCC_ChannelType:type);
  55. native DCC_GetChannelGuild(DCC_Channel:channel, &DCC_Guild:guild);
  56. native DCC_GetChannelName(DCC_Channel:channel, dest[], max_size = sizeof dest);
  57. native DCC_GetChannelTopic(DCC_Channel:channel, dest[], max_size = sizeof dest);
  58. native DCC_GetChannelPosition(DCC_Channel:channel, &position);
  59. native DCC_IsChannelNsfw(DCC_Channel:channel, &bool:is_nsfw);
  60. native DCC_GetChannelParentCategory(DCC_Channel:channel, &DCC_Channel:category);
  61. native DCC_SendChannelMessage(DCC_Channel:channel, const message[], const callback[] = "", const format[] = "", {Float, _}:...);
  62. native DCC_SetChannelName(DCC_Channel:channel, const name[]);
  63. native DCC_SetChannelTopic(DCC_Channel:channel, const topic[]);
  64. native DCC_SetChannelPosition(DCC_Channel:channel, position);
  65. native DCC_SetChannelNsfw(DCC_Channel:channel, bool:is_nsfw);
  66. native DCC_SetChannelParentCategory(DCC_Channel:channel, DCC_Channel:parent_category);
  67. native DCC_DeleteChannel(DCC_Channel:channel);
  68. // messages
  69. native DCC_GetMessageId(DCC_Message:message, dest[DCC_ID_SIZE], max_size = DCC_ID_SIZE);
  70. native DCC_GetMessageChannel(DCC_Message:message, &DCC_Channel:channel);
  71. native DCC_GetMessageAuthor(DCC_Message:message, &DCC_User:author);
  72. native DCC_GetMessageContent(DCC_Message:message, dest[], max_size = sizeof dest);
  73. native DCC_IsMessageTts(DCC_Message:message, &bool:is_tts);
  74. native DCC_IsMessageMentioningEveryone(DCC_Message:message, &bool:mentions_everyone);
  75. native DCC_GetMessageUserMentionCount(DCC_Message:message, &mentioned_user_count);
  76. native DCC_GetMessageUserMention(DCC_Message:message, offset, &DCC_User:mentioned_user);
  77. native DCC_GetMessageRoleMentionCount(DCC_Message:message, &mentioned_role_count);
  78. native DCC_GetMessageRoleMention(DCC_Message:message, offset, &DCC_Role:mentioned_role);
  79. native DCC_DeleteMessage(DCC_Message:message);
  80. native DCC_Message:DCC_GetCreatedMessage(); // for use in DCC_SendChannelMessage result callback
  81. native DCC_DeleteInternalMessage(DCC_Message:message); // This deletes a stored message, this DOES NOT delete it on discord, this is for persistent messages.
  82. native DCC_EditMessage(DCC_Message:message, const content[], DCC_Embed:embed = DCC_Embed:0);
  83. native DCC_SetMessagePersistent(DCC_Message:message, bool:persistent);
  84. native DCC_CacheChannelMessage(const channel_id[DCC_ID_SIZE], const message_id[DCC_ID_SIZE], const callback[] = "", const format[] = "", {Float, _}:...);
  85. // users
  86. native DCC_User:DCC_FindUserByName(const user_name[], const user_discriminator[]);
  87. native DCC_User:DCC_FindUserById(const user_id[]);
  88. native DCC_GetUserName(DCC_User:user, dest[DCC_USERNAME_SIZE], max_size = sizeof dest);
  89. native DCC_GetUserId(DCC_User:user, dest[DCC_ID_SIZE], max_size = DCC_ID_SIZE);
  90. native DCC_GetUserDiscriminator(DCC_User:user, dest[], max_size = sizeof dest);
  91. native DCC_IsUserBot(DCC_User:user, &bool:is_bot);
  92. native DCC_IsUserVerified(DCC_User:user, &bool:is_verified);
  93. // roles
  94. native DCC_Role:DCC_FindRoleByName(DCC_Guild:guild, const role_name[]);
  95. native DCC_Role:DCC_FindRoleById(const role_id[]);
  96. native DCC_GetRoleId(DCC_Role:role, dest[DCC_ID_SIZE], max_size = sizeof dest);
  97. native DCC_GetRoleName(DCC_Role:role, dest[], max_size = sizeof dest);
  98. native DCC_GetRoleColor(DCC_Role:role, &color);
  99. native DCC_GetRoleColour(DCC_Role:role, &colour) = DCC_GetRoleColor; // for our British mates
  100. native DCC_GetRolePermissions(DCC_Role:role, &perm_high, &perm_low); // 64 bit integer
  101. native DCC_IsRoleHoist(DCC_Role:role, &bool:is_hoist);
  102. native DCC_GetRolePosition(DCC_Role:role, &position);
  103. native DCC_IsRoleMentionable(DCC_Role:role, &bool:is_mentionable);
  104. // guilds
  105. native DCC_Guild:DCC_FindGuildByName(const guild_name[]);
  106. native DCC_Guild:DCC_FindGuildById(const guild_id[]);
  107. native DCC_GetGuildId(DCC_Guild:guild, dest[DCC_ID_SIZE], max_size = sizeof dest);
  108. native DCC_GetGuildName(DCC_Guild:guild, dest[], max_size = sizeof dest);
  109. native DCC_GetGuildOwnerId(DCC_Guild:guild, dest[DCC_ID_SIZE], max_size = sizeof dest);
  110. native DCC_GetGuildRole(DCC_Guild:guild, offset, &DCC_Role:role);
  111. native DCC_GetGuildRoleCount(DCC_Guild:guild, &count);
  112. native DCC_GetGuildMember(DCC_Guild:guild, offset, &DCC_User:user);
  113. native DCC_GetGuildMemberCount(DCC_Guild:guild, &count);
  114. native DCC_GetGuildMemberVoiceChannel(DCC_Guild:guild, DCC_User:user, &DCC_Channel:channel);
  115. native DCC_GetGuildMemberNickname(DCC_Guild:guild, DCC_User:user, dest[DCC_NICKNAME_SIZE], max_size = sizeof dest);
  116. native DCC_GetGuildMemberRole(DCC_Guild:guild, DCC_User:user, offset, &DCC_Role:role);
  117. native DCC_GetGuildMemberRoleCount(DCC_Guild:guild, DCC_User:user, &count);
  118. native DCC_HasGuildMemberRole(DCC_Guild:guild, DCC_User:user, DCC_Role:role, &bool:has_role);
  119. native DCC_GetGuildMemberStatus(DCC_Guild:guild, DCC_User:user, &DCC_UserPresenceStatus:status);
  120. native DCC_GetGuildChannel(DCC_Guild:guild, offset, &DCC_Channel:channel);
  121. native DCC_GetGuildChannelCount(DCC_Guild:guild, &count);
  122. native DCC_GetAllGuilds(DCC_Guild:dest[], max_size = sizeof dest);
  123. native DCC_SetGuildName(DCC_Guild:guild, const name[]);
  124. native DCC_CreateGuildChannel(DCC_Guild:guild, const name[], DCC_ChannelType:type, const callback[] = "", const format[] = "", {Float, _}:...);
  125. native DCC_Channel:DCC_GetCreatedGuildChannel();
  126. native DCC_SetGuildMemberNickname(DCC_Guild:guild, DCC_User:user, const nickname[]);
  127. native DCC_SetGuildMemberVoiceChannel(DCC_Guild:guild, DCC_User:user, DCC_Channel:channel);
  128. native DCC_AddGuildMemberRole(DCC_Guild:guild, DCC_User:user, DCC_Role:role);
  129. native DCC_RemoveGuildMemberRole(DCC_Guild:guild, DCC_User:user, DCC_Role:role);
  130. native DCC_RemoveGuildMember(DCC_Guild:guild, DCC_User:user); // kicks the user from the server
  131. native DCC_CreateGuildMemberBan(DCC_Guild:guild, DCC_User:user, const reason[] = "");
  132. native DCC_RemoveGuildMemberBan(DCC_Guild:guild, DCC_User:user);
  133. native DCC_SetGuildRolePosition(DCC_Guild:guild, DCC_Role:role, position);
  134. native DCC_SetGuildRoleName(DCC_Guild:guild, DCC_Role:role, const name[]);
  135. native DCC_SetGuildRolePermissions(DCC_Guild:guild, DCC_Role:role, perm_high, perm_low);
  136. native DCC_SetGuildRoleColor(DCC_Guild:guild, DCC_Role:role, color);
  137. native DCC_SetGuildRoleHoist(DCC_Guild:guild, DCC_Role:role, bool:hoist);
  138. native DCC_SetGuildRoleMentionable(DCC_Guild:guild, DCC_Role:role, bool:mentionable);
  139. native DCC_CreateGuildRole(DCC_Guild:guild, const name[], const callback[] = "", const format[] = "", {Float, _}:...);
  140. native DCC_Role:DCC_GetCreatedGuildRole();
  141. native DCC_DeleteGuildRole(DCC_Guild:guild, DCC_Role:role);
  142. // bot
  143. native DCC_BotPresenceStatus:DCC_GetBotPresenceStatus();
  144. native DCC_TriggerBotTypingIndicator(DCC_Channel:channel);
  145. native DCC_SetBotNickname(DCC_Guild:guild, const nickname[]);
  146. stock DCC_ClearBotNickname(DCC_Guild:guild)
  147. {
  148. return DCC_SetBotNickname(guild, "");
  149. }
  150. native DCC_CreatePrivateChannel(DCC_User:user, const callback[], const format[] = "", {Float, _}:...);
  151. native DCC_Channel:DCC_GetCreatedPrivateChannel();
  152. native DCC_SetBotPresenceStatus(DCC_BotPresenceStatus:status);
  153. native DCC_SetBotActivity(const name[]);
  154. stock DCC_ClearBotActivity()
  155. {
  156. return DCC_SetBotActivity("");
  157. }
  158. // misc
  159. native DCC_EscapeMarkdown(const src[], dest[], max_size = sizeof dest);
  160. // embedded messages
  161. native DCC_Embed:DCC_CreateEmbed(const title[] = "", const description[] = "", const url[] = "", const timestamp[] = "", color = 0, const footer_text[] = "", const footer_icon_url[] = "", const thumbnail_url[] = "", const image_url[] = "");
  162. native DCC_DeleteEmbed(DCC_Embed:embed);
  163. native DCC_SendChannelEmbedMessage(DCC_Channel:channel, DCC_Embed:embed, const message[] = "", const callback[] = "", const format[] = "", {Float, _}:...);
  164. native DCC_AddEmbedField(DCC_Embed:embed, const name[], const value[], bool:inline = false);
  165. native DCC_SetEmbedTitle(DCC_Embed:embed, const title[]);
  166. native DCC_SetEmbedDescription(DCC_Embed:embed, const description[]);
  167. native DCC_SetEmbedUrl(DCC_Embed:embed, const url[]);
  168. native DCC_SetEmbedTimestamp(DCC_Embed:embed, const timestamp[]);
  169. native DCC_SetEmbedColor(DCC_Embed:embed, color);
  170. native DCC_SetEmbedColour(DCC_Embed:embed, colour) = DCC_SetEmbedColor; // oi m8
  171. native DCC_SetEmbedFooter(DCC_Embed:embed, const footer_text[], const footer_icon_url[] = "");
  172. native DCC_SetEmbedThumbnail(DCC_Embed:embed, const thumbnail_url[]);
  173. native DCC_SetEmbedImage(DCC_Embed:embed, const image_url[]);
  174. // emoji
  175. native DCC_Emoji:DCC_CreateEmoji(const name[DCC_EMOJI_NAME_SIZE], const snowflake[DCC_ID_SIZE] = "");
  176. native DCC_DeleteEmoji(DCC_Emoji:emoji);
  177. native DCC_GetEmojiName(DCC_Emoji:emoji, dest[DCC_EMOJI_NAME_SIZE], maxlen = DCC_EMOJI_NAME_SIZE);
  178. // reaction
  179. native DCC_CreateReaction(DCC_Message:message, DCC_Emoji:reaction_emoji);
  180. native DCC_DeleteMessageReaction(DCC_Message:message, DCC_Emoji:reaction_emoji = DCC_Emoji:0); // if reaction_emoji is 0 (default value) this will delete ALL of the reactions on the message.
  181. // callbacks
  182. // channels
  183. forward DCC_OnChannelCreate(DCC_Channel:channel);
  184. forward DCC_OnChannelUpdate(DCC_Channel:channel);
  185. forward DCC_OnChannelDelete(DCC_Channel:channel);
  186. // messages
  187. forward DCC_OnMessageCreate(DCC_Message:message);
  188. forward DCC_OnMessageDelete(DCC_Message:message);
  189. forward DCC_OnMessageReaction(DCC_Message:message, DCC_User:reaction_user, DCC_Emoji:emoji, DCC_MessageReactionType:reaction_type);
  190. // users
  191. forward DCC_OnUserUpdate(DCC_User:user);
  192. // guilds
  193. forward DCC_OnGuildCreate(DCC_Guild:guild);
  194. forward DCC_OnGuildUpdate(DCC_Guild:guild);
  195. forward DCC_OnGuildDelete(DCC_Guild:guild);
  196. forward DCC_OnGuildMemberAdd(DCC_Guild:guild, DCC_User:user);
  197. forward DCC_OnGuildMemberUpdate(DCC_Guild:guild, DCC_User:user);
  198. forward DCC_OnGuildMemberVoiceUpdate(DCC_Guild:guild, DCC_User:user, DCC_Channel:channel);
  199. forward DCC_OnGuildMemberRemove(DCC_Guild:guild, DCC_User:user);
  200. forward DCC_OnGuildRoleCreate(DCC_Guild:guild, DCC_Role:role);
  201. forward DCC_OnGuildRoleUpdate(DCC_Guild:guild, DCC_Role:role);
  202. forward DCC_OnGuildRoleDelete(DCC_Guild:guild, DCC_Role:role);