Slash commands are cool
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

189 рядки
7.5KB

  1. use crate::discord::{Interaction, InteractionResponse, InteractionApplicationCommandCallbackData, Embed, EmbedFooter, EmbedAuthor, EmbedField};
  2. pub fn cardlife(interaction: &Interaction) -> InteractionResponse {
  3. let cmd = interaction.cmd().unwrap();
  4. // build embed
  5. let embed = Embed {
  6. title: Some("CLre and CLIPA".to_string()),
  7. type_: None,
  8. description: Some(
  9. "Cardlife is no longer received updates, not even bugfixes. \
  10. To fix that, NGnius started the CLre mod to apply bugfixes to Cardlife. \
  11. With help from Zhang and other community members, CLre now fixes most critical bugs.
  12. CLre is a code mod that requires CLIPA to work. \
  13. CLIPA patches Cardlife so that it will load CLre and other compatible mods. \
  14. To install CLIPA, download the [latest release](https://git.exmods.org/NGnius/CLIPA/releases), \
  15. then follow [steps 2 through 4](https://git.exmods.org/NGnius/CLIPA#user-content-how-to-install) \
  16. or join the official Cardlife server for more in-depth instructions. \
  17. Once CLIPA is installed, \
  18. download the latest version of [CLre](https://git.exmods.org/NGnius/CLre/releases) and place it in the Plugins folder in your Cardlife install folder."
  19. .to_string()),
  20. url: None,
  21. timestamp: None,
  22. color: Some(0x00C800), // Colour::from_rgb(0, 200, 0)
  23. footer: Some(EmbedFooter {
  24. text: "NGnius".to_string(),
  25. icon_url: Some("https://git.exmods.org/user/avatar/NGnius/-1".to_string()),
  26. proxy_icon_url: None,
  27. }),
  28. image: None,
  29. thumbnail: None,
  30. video: None,
  31. provider: None,
  32. author: Some(EmbedAuthor {
  33. name: Some("Cardlife Modding Overview".to_string()),
  34. url: Some("https://exmods.org/".to_string()),
  35. icon_url: None,
  36. proxy_icon_url: None
  37. }),
  38. fields: Some(vec![
  39. EmbedField {
  40. name: "CLre".to_string(),
  41. value: "[view releases](https://git.exmods.org/NGnius/CLre/releases)".to_string(),
  42. inline: Some(true),
  43. },
  44. EmbedField {
  45. name: "CLIPA".to_string(),
  46. value: "[view releases](https://git.exmods.org/NGnius/CLIPA/releases)".to_string(),
  47. inline: Some(true),
  48. }
  49. ])
  50. };
  51. InteractionResponse::ChannelMessageWithSource {
  52. data: Some(InteractionApplicationCommandCallbackData {
  53. tts: false,
  54. content: "".to_string(),
  55. allowed_mentions: None,
  56. embeds: Some(vec![embed]),
  57. flags: flag_by_user(&cmd.member.user.unwrap().id),
  58. }),
  59. }
  60. }
  61. pub fn robocraft(interaction: &Interaction) -> InteractionResponse {
  62. let cmd = interaction.cmd().unwrap();
  63. // build embed
  64. let embed = Embed {
  65. title: Some("RC2 and RCIPA".to_string()),
  66. type_: None,
  67. description: Some(
  68. "Robocraft modding work is still WIP, but the RC2 mod adds some much-requested features to RC. \
  69. You must install RCIPA first to load mods such as RC2, but it's definitely worth it! \
  70. RCIPA also uses some quantum computing to circumvent EAC since that prevents modifications to Robocraft.
  71. RC2 adds rotating platforms and crossplay with Robocraft Infinity (the Xbox version). \
  72. The 100 garage bay limit is also removed. \
  73. Think Procelio meets the RC15 project, but without the uncertainty, monetization, and (potential) legal problems."
  74. .to_string()),
  75. url: None,
  76. timestamp: None,
  77. color: Some(0x00C800), // Colour::from_rgb(0, 200, 0)
  78. footer: Some(EmbedFooter {
  79. text: cmd.member.nick.unwrap_or(cmd.member.user.unwrap().username),
  80. icon_url: Some("https://git.exmods.org/img/favicon.png".to_string()),
  81. proxy_icon_url: None,
  82. }),
  83. image: None,
  84. thumbnail: None,
  85. video: None,
  86. provider: None,
  87. author: Some(EmbedAuthor {
  88. name: Some("Robocraft Modding Overview".to_string()),
  89. url: Some("http://zettagram.com/".to_string()),
  90. icon_url: None,
  91. proxy_icon_url: None
  92. }),
  93. fields: Some(vec![
  94. EmbedField {
  95. name: "libfj".to_string(),
  96. value: "[more info](https://github.com/NGnius/libfj)".to_string(),
  97. inline: Some(true),
  98. }
  99. ])
  100. };
  101. InteractionResponse::ChannelMessageWithSource {
  102. data: Some(InteractionApplicationCommandCallbackData {
  103. tts: false,
  104. content: "".to_string(),
  105. allowed_mentions: None,
  106. embeds: Some(vec![embed]),
  107. flags: Some(64),
  108. }),
  109. }
  110. }
  111. pub fn techblox(interaction: &Interaction) -> InteractionResponse {
  112. let cmd = interaction.cmd().unwrap();
  113. // build embed
  114. let embed = Embed {
  115. title: Some("TechbloxModdingAPI and GCIPA".to_string()),
  116. type_: None,
  117. description: Some(
  118. "Techblox is the latest iteration of Freejam's new sandbox game. \
  119. This iterative approach allows us to reuse some mod tools from Gamecraft like GCIPA. \
  120. TechbloxModdingAPI is a standard API that most mods use to interface with Techblox, \
  121. which is also adapted from it's Gamecraft counterpart.
  122. GCIPA patches Techblox so that it will load compatible mods. \
  123. To install GCIPA, download the [latest release](https://git.exmods.org/modtainers/GCIPA/releases), \
  124. then follow [steps 2 through 4](https://git.exmods.org/modtainers/GCIPA/releases) \
  125. or ask for more in-depth instructions. \
  126. Once GCIPA is installed, \
  127. download the latest version of [TechbloxModdingAPI](https://git.exmods.org/modtainers/GamecraftModdingAPI/releases) and place it in the Plugins folder in your Techblox install folder."
  128. .to_string()),
  129. url: None,
  130. timestamp: None,
  131. color: Some(0x00C800), // Colour::from_rgb(0, 200, 0)
  132. footer: Some(EmbedFooter {
  133. text: "NGnius".to_string(),
  134. icon_url: Some("https://git.exmods.org/user/avatar/NGnius/-1".to_string()),
  135. proxy_icon_url: None,
  136. }),
  137. image: None,
  138. thumbnail: None,
  139. video: None,
  140. provider: None,
  141. author: Some(EmbedAuthor {
  142. name: Some("Techblox Modding Overview".to_string()),
  143. url: Some("https://exmods.org/".to_string()),
  144. icon_url: None,
  145. proxy_icon_url: None
  146. }),
  147. fields: Some(vec![
  148. EmbedField {
  149. name: "GCIPA".to_string(),
  150. value: "[view releases](https://git.exmods.org/modtainers/GCIPA/releases)".to_string(),
  151. inline: Some(true),
  152. },
  153. EmbedField {
  154. name: "TechbloxModdingAPI".to_string(),
  155. value: "[view release](https://git.exmods.org/modtainers/GamecraftModdingAPI/releases)".to_string(),
  156. inline: Some(true),
  157. },
  158. EmbedField {
  159. name: "Mods".to_string(),
  160. value: "[view list](https://exmods.org/mods/)".to_string(),
  161. inline: Some(true),
  162. },
  163. ])
  164. };
  165. InteractionResponse::ChannelMessageWithSource {
  166. data: Some(InteractionApplicationCommandCallbackData {
  167. tts: false,
  168. content: "".to_string(),
  169. allowed_mentions: None,
  170. embeds: Some(vec![embed]),
  171. flags: flag_by_user(&cmd.member.user.unwrap().id),
  172. }),
  173. }
  174. }
  175. fn flag_by_user(id: &str) -> Option<usize> {
  176. if id == "106537989684887552" /* NGnius */ {
  177. return None;
  178. } else {
  179. return Some(64);
  180. }
  181. }