AlferZep

$onInteraction

Mar 30th, 2024
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.25 KB | None | 0 0
  1. $nomention
  2. $onlyIf[$and[$checkContains[$customID;novel]==true;$checkContains[$customID;$authorID]==true]==true;]
  3.  
  4. $jsonParse[
  5. {
  6. "novel":$getVar[novel;$authorID]
  7. }
  8. ]
  9.  
  10. $httpAddHeader[content-type;application/x-www-form-urlencoded]
  11.  
  12. $httpPost[https://pastebin.com/api/api_raw.php;api_dev_key=$getVar[paste_key]&api_user_key=$getVar[paste_user_key]&api_paste_key=$replaceText[$json[novel;link];https://pastebin.com/raw/;]&api_option=show_paste]
  13.  
  14. $jsonParse[
  15. {
  16. "novel":$getVar[novel;$authorID],
  17. "link":$httpResult
  18. }
  19. ]
  20.  
  21. $var[page;$json[novel;page]]
  22. $var[chapter;$json[novel;chapter]]
  23.  
  24. $if[$customID==novel read $authorID]
  25. $removeButtons
  26.  
  27. $jsonSet[novel;chapter;1]
  28.  
  29. $jsonSet[novel;page;0]
  30.  
  31. $setVar[novel;$json[novel];$authorID]
  32.  
  33. $addButton[no;novel prev $authorID;Prev;secondary]
  34. $addButton[no;novel next $authorID;Next;secondary]
  35. $addButton[no;novel jump $authorID;Jump to;secondary]
  36.  
  37. $elseif[$customID==novel next $authorID]
  38.  
  39. $if[$sum[1;$json[novel;page]]>=$jsonArrayCount[link;chapter;$json[novel;chapter];page]]
  40. $jsonSet[novel;page;0]
  41. $jsonSet[novel;chapter;$sum[$var[chapter];1]]
  42. $else
  43. $jsonSet[novel;page;$sum[$var[page];1]]
  44. $endif
  45.  
  46. $setVar[novel;$json[novel];$authorID]
  47.  
  48. $elseif[$customID==novel prev $authorID]
  49.  
  50. $if[$and[$var[chapter]>1;$sum[1;$var[page]]<=1]==true]
  51. $jsonSet[novel;chapter;$sub[$var[chapter];1]]
  52. $jsonSet[novel;page;$sub[$jsonArrayCount[link;chapter;$json[novel;chapter];page];1]]
  53. $else
  54. $jsonSet[novel;page;$sub[$var[page];1]]
  55. $endif
  56.  
  57. $setVar[novel;$json[novel];$authorID]
  58.  
  59. $elseif[$customID==novel jump $authorID]
  60.  
  61. $newModal[novel mjump $authorID;Jump to]
  62. $addTextInput[chapter;short;Chapter;1;4;yes;;Current: $var[chapter] of $json[link;chapters]]
  63. $addTextInput[page;short;Page;1;4;yes;;Current: $sum[$var[page];1] of $jsonArrayCount[link;chapter;$json[novel;chapter];page]]
  64.  
  65. $elseif[$customID==novel mjump $authorID]
  66.  
  67. $if[$and[$input[page]<=$jsonArrayCount[link;chapter;$input[chapter];page];$input[page]>=1]==true]
  68. $if[$and[$input[chapter]<=$json[link;chapters];$input[chapter]>=1]==true]
  69. $deleteMessage[$channelID;$messageID]
  70. $jsonSet[novel;chapter;$input[chapter]]
  71. $jsonSet[novel;page;$sub[$input[page];1]]
  72.  
  73. $addButton[no;novel prev $authorID;Prev;secondary]
  74. $addButton[no;novel next $authorID;Next;secondary]
  75. $addButton[no;novel jump $authorID;Jump to;secondary]
  76. $else
  77. $var[error;true]
  78. $ephemeral
  79. There is only $json[link;chapters] chapters in this novel.
  80. $endif
  81. $else
  82. $var[error;true]
  83. $ephemeral
  84. There is only $jsonArrayCount[link;chapter;$input[chapter];page] pages in chapter $input[chapter].
  85. $endif
  86.  
  87. $setVar[novel;$json[novel];$authorID]
  88.  
  89. $endif
  90.  
  91. $if[$and[$json[novel;chapter]>1;$sum[1;$json[novel;page]]<=1]==true]
  92. $editButton[novel prev $authorID;Prev Ch;secondary;no]
  93. $elseif[$sum[1;$json[novel;page]]<=1]
  94. $editButton[novel prev $authorID;Prev;secondary;yes]
  95. $else
  96. $editButton[novel prev $authorID;Prev;secondary;no]
  97. $endif
  98.  
  99. $if[$and[$sum[1;$json[novel;page]]>=$jsonArrayCount[link;chapter;$json[novel;chapter];page];$json[link;chapters]>$json[novel;chapter]]==true]
  100. $editButton[novel next $authorID;Next Chapter;secondary;no]
  101. $elseif[$and[$sum[1;$json[novel;page]]>=$jsonArrayCount[link;chapter;$json[novel;chapter];page];$json[link;chapters]<=$json[novel;chapter]]==true]
  102. $editButton[novel next $authorID;End;secondary;yes]
  103. $else
  104. $editButton[novel next $authorID;Next;secondary;no]
  105. $endif
  106.  
  107. $if[$var[error]!=true]
  108. $author[$username]
  109. $authorIcon[$authorAvatar]
  110. $title[Chapter $json[novel;chapter] of $json[link;chapters] - $json[link;chapter;$json[novel;chapter];title]]
  111. $description[$json[link;chapter;$json[novel;chapter];page;$json[novel;page]]]
  112. $if[$sum[1;$json[novel;page]]>=$jsonArrayCount[link;chapter;$json[novel;chapter];page]]
  113. $footer[Page $sum[1;$json[novel;page]] of $jsonArrayCount[link;chapter;$json[novel;chapter];page] - End of Chapter $json[novel;chapter]]
  114. $else
  115. $footer[Page $sum[1;$json[novel;page]] of $jsonArrayCount[link;chapter;$json[novel;chapter];page]]
  116. $endif
  117.  
  118. $if[$json[link;chapter;$json[novel;chapter];notes;$json[novel;page]]!=]
  119.  
  120. $jsonParse[
  121. $json[link;chapter;$json[novel;chapter];notes;$json[novel;page]]
  122. ]
  123.  
  124. $title[$json[title];2]
  125. $description[$json[description];2]
  126. $thumbnail[$json[thumbnail];2]
  127. $color[#c9c7c7;2]
  128. $endif
  129.  
  130. $endif
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
Advertisement
Add Comment
Please, Sign In to add comment