discord-connector.inc 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. /* Discord Connector
  2. * Version v0.3.2
  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. #define DCC_INVALID_CHANNEL DCC_Channel:0
  35. #define DCC_INVALID_USER DCC_User:0
  36. #define DCC_INVALID_ROLE DCC_Role:0
  37. #define DCC_INVALID_GUILD DCC_Guild:0
  38. #define DCC_ID_SIZE (20 + 1)
  39. // natives
  40. // channels
  41. native DCC_Channel:DCC_FindChannelByName(const channel_name[]);
  42. native DCC_Channel:DCC_FindChannelById(const channel_id[]);
  43. native DCC_GetChannelId(DCC_Channel:channel, dest[DCC_ID_SIZE], max_size = sizeof dest);
  44. native DCC_GetChannelType(DCC_Channel:channel, &DCC_ChannelType:type);
  45. native DCC_GetChannelGuild(DCC_Channel:channel, &DCC_Guild:guild);
  46. native DCC_GetChannelName(DCC_Channel:channel, dest[], max_size = sizeof dest);
  47. native DCC_GetChannelTopic(DCC_Channel:channel, dest[], max_size = sizeof dest);
  48. native DCC_GetChannelPosition(DCC_Channel:channel, &position);
  49. native DCC_IsChannelNsfw(DCC_Channel:channel, &bool:is_nsfw);
  50. native DCC_GetChannelParentCategory(DCC_Channel:channel, &DCC_Channel:category);
  51. native DCC_SendChannelMessage(DCC_Channel:channel, const message[], const callback[] = "", const format[] = "", {Float, _}:...);
  52. native DCC_SetChannelName(DCC_Channel:channel, const name[]);
  53. native DCC_SetChannelTopic(DCC_Channel:channel, const topic[]);
  54. native DCC_SetChannelPosition(DCC_Channel:channel, position);
  55. native DCC_SetChannelNsfw(DCC_Channel:channel, bool:is_nsfw);
  56. native DCC_SetChannelParentCategory(DCC_Channel:channel, DCC_Channel:parent_category);
  57. native DCC_DeleteChannel(DCC_Channel:channel);
  58. // messages
  59. native DCC_GetMessageId(DCC_Message:message, dest[DCC_ID_SIZE], max_size = DCC_ID_SIZE);
  60. native DCC_GetMessageChannel(DCC_Message:message, &DCC_Channel:channel);
  61. native DCC_GetMessageAuthor(DCC_Message:message, &DCC_User:author);
  62. native DCC_GetMessageContent(DCC_Message:message, dest[], max_size = sizeof dest);
  63. native DCC_IsMessageTts(DCC_Message:message, &bool:is_tts);
  64. native DCC_IsMessageMentioningEveryone(DCC_Message:message, &bool:mentions_everyone);
  65. native DCC_GetMessageUserMentionCount(DCC_Message:message, &mentioned_user_count);
  66. native DCC_GetMessageUserMention(DCC_Message:message, offset, &DCC_User:mentioned_user);
  67. native DCC_GetMessageRoleMentionCount(DCC_Message:message, &mentioned_role_count);
  68. native DCC_GetMessageRoleMention(DCC_Message:message, offset, &DCC_Role:mentioned_role);
  69. native DCC_DeleteMessage(DCC_Message:message);
  70. native DCC_Message:DCC_GetCreatedMessage(); // for use in DCC_SendChannelMessage result callback
  71. // users
  72. native DCC_User:DCC_FindUserByName(const user_name[], const user_discriminator[]);
  73. native DCC_User:DCC_FindUserById(const user_id[]);
  74. native DCC_GetUserId(DCC_User:user, dest[DCC_ID_SIZE], max_size = DCC_ID_SIZE);
  75. native DCC_GetUserName(DCC_User:user, dest[], max_size = sizeof dest);
  76. native DCC_GetUserDiscriminator(DCC_User:user, dest[], max_size = sizeof dest);
  77. native DCC_IsUserBot(DCC_User:user, &bool:is_bot);
  78. native DCC_IsUserVerified(DCC_User:user, &bool:is_verified);
  79. // roles
  80. native DCC_Role:DCC_FindRoleByName(DCC_Guild:guild, const role_name[]);
  81. native DCC_Role:DCC_FindRoleById(const role_id[]);
  82. native DCC_GetRoleId(DCC_Role:role, dest[DCC_ID_SIZE], max_size = sizeof dest);
  83. native DCC_GetRoleName(DCC_Role:role, dest[], max_size = sizeof dest);
  84. native DCC_GetRoleColor(DCC_Role:role, &color);
  85. native DCC_GetRoleColour(DCC_Role:role, &colour) = DCC_GetRoleColor; // for our British mates
  86. native DCC_GetRolePermissions(DCC_Role:role, &perm_high, &perm_low); // 64 bit integer
  87. native DCC_IsRoleHoist(DCC_Role:role, &bool:is_hoist);
  88. native DCC_GetRolePosition(DCC_Role:role, &position);
  89. native DCC_IsRoleMentionable(DCC_Role:role, &bool:is_mentionable);
  90. // guilds
  91. native DCC_Guild:DCC_FindGuildByName(const guild_name[]);
  92. native DCC_Guild:DCC_FindGuildById(const guild_id[]);
  93. native DCC_GetGuildId(DCC_Guild:guild, dest[DCC_ID_SIZE], max_size = sizeof dest);
  94. native DCC_GetGuildName(DCC_Guild:guild, dest[], max_size = sizeof dest);
  95. native DCC_GetGuildOwnerId(DCC_Guild:guild, dest[DCC_ID_SIZE], max_size = sizeof dest);
  96. native DCC_GetGuildRole(DCC_Guild:guild, offset, &DCC_Role:role);
  97. native DCC_GetGuildRoleCount(DCC_Guild:guild, &count);
  98. native DCC_GetGuildMember(DCC_Guild:guild, offset, &DCC_User:user);
  99. native DCC_GetGuildMemberCount(DCC_Guild:guild, &count);
  100. native DCC_GetGuildMemberVoiceChannel(DCC_Guild:guild, DCC_User:user, &DCC_Channel:channel);
  101. native DCC_GetGuildMemberNickname(DCC_Guild:guild, DCC_User:user, dest[], max_size = sizeof dest);
  102. native DCC_GetGuildMemberRole(DCC_Guild:guild, DCC_User:user, offset, &DCC_Role:role);
  103. native DCC_GetGuildMemberRoleCount(DCC_Guild:guild, DCC_User:user, &count);
  104. native DCC_HasGuildMemberRole(DCC_Guild:guild, DCC_User:user, DCC_Role:role, &bool:has_role);
  105. native DCC_GetGuildMemberStatus(DCC_Guild:guild, DCC_User:user, &DCC_UserPresenceStatus:status);
  106. native DCC_GetGuildChannel(DCC_Guild:guild, offset, &DCC_Channel:channel);
  107. native DCC_GetGuildChannelCount(DCC_Guild:guild, &count);
  108. native DCC_GetAllGuilds(DCC_Guild:dest[], max_size = sizeof dest);
  109. native DCC_SetGuildName(DCC_Guild:guild, const name[]);
  110. native DCC_CreateGuildChannel(DCC_Guild:guild, const name[], DCC_ChannelType:type, const callback[] = "", const format[] = "", {Float, _}:...);
  111. native DCC_Channel:DCC_GetCreatedGuildChannel();
  112. native DCC_SetGuildMemberNickname(DCC_Guild:guild, DCC_User:user, const nickname[]);
  113. native DCC_SetGuildMemberVoiceChannel(DCC_Guild:guild, DCC_User:user, DCC_Channel:channel);
  114. native DCC_AddGuildMemberRole(DCC_Guild:guild, DCC_User:user, DCC_Role:role);
  115. native DCC_RemoveGuildMemberRole(DCC_Guild:guild, DCC_User:user, DCC_Role:role);
  116. native DCC_RemoveGuildMember(DCC_Guild:guild, DCC_User:user); // kicks the user from the server
  117. native DCC_CreateGuildMemberBan(DCC_Guild:guild, DCC_User:user, const reason[] = "");
  118. native DCC_RemoveGuildMemberBan(DCC_Guild:guild, DCC_User:user);
  119. native DCC_SetGuildRolePosition(DCC_Guild:guild, DCC_Role:role, position);
  120. native DCC_SetGuildRoleName(DCC_Guild:guild, DCC_Role:role, const name[]);
  121. native DCC_SetGuildRolePermissions(DCC_Guild:guild, DCC_Role:role, perm_high, perm_low);
  122. native DCC_SetGuildRoleColor(DCC_Guild:guild, DCC_Role:role, color);
  123. native DCC_SetGuildRoleHoist(DCC_Guild:guild, DCC_Role:role, bool:hoist);
  124. native DCC_SetGuildRoleMentionable(DCC_Guild:guild, DCC_Role:role, bool:mentionable);
  125. native DCC_CreateGuildRole(DCC_Guild:guild, const name[], const callback[] = "", const format[] = "", {Float, _}:...);
  126. native DCC_Role:DCC_GetCreatedGuildRole();
  127. native DCC_DeleteGuildRole(DCC_Guild:guild, DCC_Role:role);
  128. // bot
  129. native DCC_BotPresenceStatus:DCC_GetBotPresenceStatus();
  130. native DCC_TriggerBotTypingIndicator(DCC_Channel:channel);
  131. native DCC_SetBotNickname(DCC_Guild:guild, const nickname[]);
  132. stock DCC_ClearBotNickname(DCC_Guild:guild)
  133. {
  134. return DCC_SetBotNickname(guild, "");
  135. }
  136. native DCC_CreatePrivateChannel(DCC_User:user, const callback[] = "", const format[] = "", {Float, _}:...);
  137. native DCC_Channel:DCC_GetCreatedPrivateChannel();
  138. native DCC_SetBotPresenceStatus(DCC_BotPresenceStatus:status);
  139. native DCC_SetBotActivity(const name[]);
  140. stock DCC_ClearBotActivity()
  141. {
  142. return DCC_SetBotActivity("");
  143. }
  144. // misc
  145. native DCC_EscapeMarkdown(const src[], dest[], max_size = sizeof dest);
  146. // callbacks
  147. // channels
  148. forward DCC_OnChannelCreate(DCC_Channel:channel);
  149. forward DCC_OnChannelUpdate(DCC_Channel:channel);
  150. forward DCC_OnChannelDelete(DCC_Channel:channel);
  151. // messages
  152. forward DCC_OnMessageCreate(DCC_Message:message);
  153. forward DCC_OnMessageDelete(DCC_Message:message);
  154. // users
  155. forward DCC_OnUserUpdate(DCC_User:user);
  156. // guilds
  157. forward DCC_OnGuildCreate(DCC_Guild:guild);
  158. forward DCC_OnGuildUpdate(DCC_Guild:guild);
  159. forward DCC_OnGuildDelete(DCC_Guild:guild);
  160. forward DCC_OnGuildMemberAdd(DCC_Guild:guild, DCC_User:user);
  161. forward DCC_OnGuildMemberUpdate(DCC_Guild:guild, DCC_User:user);
  162. forward DCC_OnGuildMemberVoiceUpdate(DCC_Guild:guild, DCC_User:user, DCC_Channel:channel);
  163. forward DCC_OnGuildMemberRemove(DCC_Guild:guild, DCC_User:user);
  164. forward DCC_OnGuildRoleCreate(DCC_Guild:guild, DCC_Role:role);
  165. forward DCC_OnGuildRoleUpdate(DCC_Guild:guild, DCC_Role:role);
  166. forward DCC_OnGuildRoleDelete(DCC_Guild:guild, DCC_Role:role);