Advertisement
Aouchan

Anime info (Kitsu API)

Jun 22nd, 2023 (edited)
663
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASM (NASM) 4.72 KB | Source Code | 0 0
  1. $nomention
  2. $reply
  3. $allowUserMentions[]
  4.  
  5. $try
  6.   $onlyIf[$guildID!=;]
  7. $catch
  8.   $ephemeral
  9.   You can not use this command in DMs
  10.   $stop
  11. $endtry
  12.  
  13. $try
  14.   $globalCooldown[7s;]
  15. $catch
  16.   $ephemeral
  17.   You are on cooldown! Try again <t:$sum[$getTimestamp;$getCooldown[global]]:R>
  18.   $stop
  19. $endtry
  20.  
  21. $if[$isSlash==true]
  22.     $defer
  23.     $var[anime;$toLowercase[$message[anime]]]
  24. $else
  25.     $botTyping
  26.     $argsCheck[>1;Please provide an anime for me to search!]
  27.     $var[anime;$toLowercase[$message]]
  28. $endif
  29.  
  30. $httpGet[https://kitsu.io/api/edge/anime?filter%5Btext%5D=$url[encode;$var[anime]]]
  31.  $jsonSet[kitsu;$httpResult]
  32.    $jsonParse[$json[kitsu]]
  33.     $var[kitsu.io;$cropText[$replaceText[$jsonPretty[2];";;-1];3000;...]]
  34.    
  35. $try
  36.   $onlyIf[$json[data]!=[\];]
  37. $catch
  38.   $ephemeral
  39.   $if[$isSlash==false]
  40.       Anime `"$message"` not found.
  41.   $else
  42.       Anime `"$message[anime]"` not found.
  43.   $endif
  44.   $stop
  45. $endtry
  46.  
  47.   $var[cover.img;$json[data;0;attributes;coverImage;original]]
  48.   $var[synopsis;$cropText[$json[data;0;attributes;description];500;...]]
  49.      
  50. $async[nyah]
  51.   $httpGet[$json[data;0;relationships;genres;links;related]]
  52.   $jsonParse[$httpResult]
  53.  
  54.   $var[q;0]
  55.   $var[Array.Count;$jsonArrayCount[data]]
  56.  
  57.   $if[$json[data]!=[\]]
  58.       $var[g;$eval[$replaceText[$cropText[$repeatMessage[10;$repeatMessage[3;a]];$var[Array.Count];];a;$replaceText[.json[data\;.var[q\]\;attributes\;name\], .var[q\;.sum[.var[q\]\;1\]\];.;$];-1]]]
  59.       $textSplit[$var[g];,]
  60.       $var[s;$sub[$getTextSplitLength;1]]
  61.      
  62.       $var[genres;$replaceText[$joinSplitText[,];$splitText[$var[s]],;$splitText[$var[s]]]]
  63.   $else
  64.       $var[i;No Genres Found]
  65.   $endif
  66. $endasync $await[nyah]
  67.  
  68. $async[meow]
  69.   $httpGet[$json[data;0;relationships;animeProductions;links;related]]
  70.  
  71.   $if[$httpResult[data]!=[\]]
  72.       $var[producer;$httpResult[data;0;relationships;producer;links;related]]
  73.       $httpGet[$var[producer]]
  74.      
  75.       $jsonParse[$httpResult]
  76.       $if[$json[data;attributes;name]!=]
  77.           $var[studios;$json[data;attributes;name]]
  78.       $endif
  79.   $else
  80.       $var[studios;N/A]
  81.   $endif
  82. $endasync $await[meow]
  83.  
  84. $if[$var[cover.img]==]
  85.     $var[index;1]
  86. $else
  87.     $var[index;2]
  88. $endif
  89.  
  90. $var[inline?;false]
  91.  
  92. $if[$charCount[$var[synopsis]]<=500]
  93.     $var[desc;$var[synopsis]]
  94. $else
  95.     $var[desc;$var[synopsis][Read More\](https://kitsu.io/anime/$json[data;0;attributes;slug])]
  96. $endif
  97.  
  98. $var[episodes;$trimSpace[$if[$json[data;0;attributes;episodeCount]!=] $json[data;0;attributes;episodeCount] $else No data $endif]]
  99. $var[status;$trimSpace[$if[$json[data;0;attributes;status]!=] $toTitleCase[$json[data;0;attributes;status]] $else No Data $endif]]
  100. $var[average.rating;$trimSpace[$if[$json[data;0;attributes;averageRating]!=] $json[data;0;attributes;averageRating] $else No Rating $endif]]
  101. $var[rank;$trimSpace[$if[$json[data;0;attributes;ratingRank]!=] #$json[data;0;attributes;ratingRank] $else Not ranked $endif]]
  102.  
  103. $if[$var[episodes]!=No data]
  104.     $var[length;*(Each $json[data;0;attributes;episodeLength] minutes in length)*]
  105. $endif
  106.  
  107. $if[$json[data;0;attributes;startDate]!=]
  108.     $var[start;From $json[data;0;attributes;startDate] to]
  109. $else
  110.     $var[start;Not Aired Yet]
  111. $endif
  112.  
  113. $if[$var[start]!=Not Aired Yet]
  114.     $if[$json[data;0;attributes;endDate]!=]
  115.         $var[end;$json[data;0;attributes;endDate]]
  116.     $else
  117.         $var[end;???]
  118.     $endif
  119. $else
  120.     $var[end;]
  121. $endif
  122.    
  123. $image[$var[cover.img];1]
  124. $color[$random[1;16777216];1]
  125.  
  126. $title[$json[data;0;attributes;canonicalTitle];$var[index]]
  127.  $addField[📖 Synopsis;$var[desc];$var[inline?];$var[index]]
  128.   $addField[💠 Episodes;$var[episodes] $var[length];$var[inline?];$var[index]]
  129.    $addField[🌺 Genres;$var[genres]$var[i];$var[inline?];$var[index]]
  130.     $addField[⏳ Status;$replaceText[$var[status];Tba;To be announced];$var[inline?];$var[index]]
  131.      $addField[💌 Titles;**English Title:** $json[data;0;attributes;titles;en]
  132. **Japanese Title:** $json[data;0;attributes;titles;ja_jp];$var[inline?];$var[index]]
  133.        $addField[⭐ Ranked;$var[rank];$var[inline?];$var[index]]
  134.       $addField[☂️ Rated;$json[data;0;attributes;ageRating] - $json[data;0;attributes;ageRatingGuide];$var[inline?];$var[index]]
  135.      $addField[🌀 Average Rating;$var[average.rating];$var[inline?];$var[index]]
  136.     $addField[☘️ Studios;$var[studios];$var[inline?];$var[index]]
  137.    $addField[⌚ Aired;$var[start] $var[end];$var[inline?];$var[index]]
  138.   $image[$json[data;0;attributes;posterImage;original];$var[index]]
  139.  $color[$optOff[$random[1;16777216]];$var[index]]
  140. $addTimestamp[$var[index]]
  141.    
  142. $if[$json[data;0;attributes;youtubeVideoId]!=]
  143.     $addButton[no;https://youtu.be/$json[data;0;attributes;youtubeVideoId];Trailer;link]
  144. $endif
Tags: BDFD
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement