Advertisement
otfr

Account System Interaction

May 14th, 2024 (edited)
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VBScript 15.22 KB | Source Code | 0 0
  1. $nomention
  2. $var[walatpass;abcd] $c[put your password instead of abcd]
  3. $textSplit[$customID;+]
  4. $var[customID;$splitText[1]]
  5. $var[authorID;$splitText[2]]
  6. $var[data;$splitText[3]]
  7. $if[$var[customID]==acc.register]
  8.  $if[$var[authorID]!=$authorID]
  9.  $ephemeral
  10.  $removeAllComponents
  11.  $addField[Error;You are not the author of this command]
  12.  $color[2b2d31]
  13.  $stop
  14.  $endif
  15. $removeButtons
  16. $color[2b2d31]
  17. $title[Account Creation]
  18. $description[Username : ```-```
  19. Password : ```-```]
  20. $addButton[no;acc.register.enter+$authorID;Enter Username/Password;primary]
  21. $addButton[no;acc.register.save+$authorID;Save;secondary;yes]
  22. $addButton[no;delete+$authorID;Close;danger]
  23. $endif
  24. $if[$var[customID]==acc.register.enter]
  25.  $if[$var[authorID]!=$authorID]
  26.  $ephemeral
  27.  $removeAllComponents
  28.  $addField[Error;You are not the author of this command]
  29.  $color[2b2d31]
  30.  $stop
  31.  $endif
  32. $textSplit[$var[data];-]
  33. $var[username;$splitText[1]]
  34. $var[pass;$splitText[2]]
  35. $newModal[acc.register.modal;Account Creation]
  36. $addTextInput[username;short;Username;3;16;yes;$var[username];User]
  37. $addTextInput[pass;short;Password;6;8;yes;$var[pass];Pass123@]
  38. $endif
  39. $if[$var[customID]==acc.register.modal]
  40.   $if[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$toLowercase[$input[username]];a;];b;];c;];d;];e;];f;];g;];h;];i;];j;];k;];l;];m;];n;];o;];p;];q;];r;];s;];t;];u;];v;];w;];x;];y;];z;];.;];0;];1;];2;];3;];4;];5;];6;];7;];8;];9;]!=]
  41. $ephemeral
  42. $removeAllComponents
  43. $color[2b2d31]
  44. $addField[Invalid Username Input;You can only have a-z(English alphabet), 0-9(numbers), .(dots) and _(underscores) in your username]
  45.   $elseif[$checkContains[$input[pass];1;2;3;4;5;6;7;8;9;0]==false]
  46. $ephemeral
  47. $removeAllComponents
  48. $color[2b2d31]
  49. $addField[Invalid Password Input;You must enter a number in your password]
  50.   $elseif[$checkContains[$input[pass];+;-;.;~]==true]
  51. $ephemeral
  52. $removeAllComponents
  53. $color[2b2d31]
  54. $addField[Invalid Password Input;You can not use +,-,.,~ symbols in your password]
  55.   $else
  56. $editMessage[$channelID;$messageID;;Account Creation;Username : ```$toLowercase[$input[username]]```
  57. Password : ```$replaceText[$replaceText[$replaceText[$charCount[$input[pass]];6;******];7;*******];8;********]```;2b2d31;]
  58. $var[dataA;$toLowercase[$input[username]]-$input[pass]]
  59. $removeButtons[$messageID]
  60. $addButton[no;acc.register.enter+$authorID+$var[dataA];Edit Username/Password;secondary;no;;$messageID]
  61. $addButton[no;acc.register.save+$authorID+$var[dataA];Save;success;no;;$messageID]
  62. $addButton[no;delete+$authorID;Close;danger;no;;$messageID]
  63.   $endif
  64. $endif
  65. $if[$var[customID]==acc.register.save]
  66.  $if[$var[authorID]!=$authorID]
  67.  $ephemeral
  68.  $removeAllComponents
  69.  $addField[Error;You are not the author of this command]
  70.  $color[2b2d31]
  71.  $stop
  72.  $endif
  73. $textSplit[$var[data];-]
  74. $var[username;$splitText[1]]
  75. $var[pass;$splitText[2]]
  76. $var[date;"$getTimestamp"]
  77. $var[AccID;$random[1111;10000]×$randomString[10]]
  78. $httpPost[http://api.walat.uk/get_variable/$botID/Accounts;{"password" : "$var[walatpass]"}]
  79. $jsonParse[$url[decode;$httpResult[Accounts]]]
  80.   $if[$jsonExists[$var[username]]==true]
  81. $ephemeral
  82. $removeAllComponents
  83. $addField[Failed;This username is already taken.]
  84. $color[2b2d31]
  85.   $else
  86. $jsonSetString[$var[username];AccID;$var[AccID]]
  87. $jsonSetString[$var[username];Pass;$var[pass]]
  88. $jsonSetString[$var[username];Date;$var[date]]
  89. $jsonArrayAppend[$var[username];Users;"$authorID"]
  90. $disableInnerSpaceRemoval
  91. $httpPost[http://api.walat.uk/set_variable/$botID/Accounts;{"password" : "$var[walatpass]","value" : "$url[encode;$jsonStringify]"}]
  92. $sendMessage[Walat API ```js
  93. $jsonPretty[]```]
  94.     $if[$httpResult[message]!=Variable set successfully]
  95. $removeButtons
  96. $addField[Error;Something went wrong with storing your data. please try again later]
  97. $color[2b2d31]
  98. $stop
  99.     $else
  100. $jsonParse[$getVar[Acc;$authorID]]
  101. $jsonSetString[Username;$var[username]]
  102. $jsonSetString[Pass;$var[pass]]
  103. $jsonSetString[Date;$var[date]]
  104. $jsonSetString[AccID;$var[AccID]]
  105. $setVar[Acc;$jsonStringify;$authorID]
  106. $removeButtons
  107. $color[2b2d31]
  108. $addField[Registered;Successfully created the account $var[username] and logged in.]
  109.     $endif
  110.   $endif
  111. $endif
  112. $if[$var[customID]==acc.login]
  113.  $if[$var[authorID]!=$authorID]
  114.  $ephemeral
  115.  $removeAllComponents
  116.  $addField[Error;You are not the author of this command]
  117.  $color[2b2d31]
  118.  $stop
  119.  $endif
  120. $removeButtons
  121. $color[2b2d31]
  122. $title[Account Login]
  123. $description[Username : ```-```
  124. Password : ```-```]
  125. $addButton[no;acc.login.enter+$authorID;Enter Username/Password;primary]
  126. $addButton[no;acc.login.go+$authorID;Login;secondary;yes]
  127. $addButton[no;delete+$authorID;Close;danger]
  128. $endif
  129. $if[$var[customID]==acc.login.enter]
  130.  $if[$var[authorID]!=$authorID]
  131.  $ephemeral
  132.  $removeAllComponents
  133.  $addField[Error;You are not the author of this command]
  134.  $color[2b2d31]
  135.  $stop
  136.  $endif
  137. $textSplit[$var[data];-]
  138. $var[username;$splitText[1]]
  139. $var[pass;$splitText[2]]
  140. $newModal[acc.login.modal;Account Login]
  141. $addTextInput[username;short;Username;3;16;yes;$var[username];User]
  142. $addTextInput[pass;short;Password;6;8;yes;$var[pass];Pass123@]
  143. $endif
  144. $if[$var[customID]==acc.login.modal]
  145.   $if[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$toLowercase[$input[username]];a;];b;];c;];d;];e;];f;];g;];h;];i;];j;];k;];l;];m;];n;];o;];p;];q;];r;];s;];t;];u;];v;];w;];x;];y;];z;];.;];0;];1;];2;];3;];4;];5;];6;];7;];8;];9;]!=]
  146. $ephemeral
  147. $removeAllComponents
  148. $color[2b2d31]
  149. $addField[Invalid Username Input;You can only have a-z(English alphabet), 0-9(numbers), .(dots) and _(underscores) in your username]
  150.   $elseif[$checkContains[$input[pass];1;2;3;4;5;6;7;8;9;0]==false]
  151. $ephemeral
  152. $removeAllComponents
  153. $color[2b2d31]
  154. $addField[Invalid Password Input;You must enter a number in your password]
  155.   $elseif[$checkContains[$input[pass];+;-;.;~]==true]
  156. $ephemeral
  157. $removeAllComponents
  158. $color[2b2d31]
  159. $addField[Invalid Password Input;You can not use +,-,.,~ symbols in your password]
  160.   $else
  161. $editMessage[$channelID;$messageID;;Account Login;Username : ```$toLowercase[$input[username]]```
  162. Password : ```$replaceText[$replaceText[$replaceText[$charCount[$input[pass]];6;******];7;*******];8;********]```;2b2d31;]
  163. $var[dataA;$toLowercase[$input[username]]-$input[pass]]
  164. $removeButtons[$messageID]
  165. $addButton[no;acc.login.enter+$authorID+$var[dataA];Edit Username/Password;secondary;no;;$messageID]
  166. $addButton[no;acc.login.go+$authorID+$var[dataA];Login;success;no;;$messageID]
  167. $addButton[no;delete+$authorID;Close;danger;no;;$messageID]
  168.   $endif
  169. $endif
  170. $if[$var[customID]==acc.login.go]
  171.  $if[$var[authorID]!=$authorID]
  172.  $ephemeral
  173.  $removeAllComponents
  174.  $addField[Error;You are not the author of this command]
  175.  $color[2b2d31]
  176.  $stop
  177.  $endif
  178. $textSplit[$var[data];-]
  179. $var[username;$splitText[1]]
  180. $var[pass;$splitText[2]]
  181. $httpPost[http://api.walat.uk/get_variable/$botID/Accounts;{"password" : "123"}]
  182. $jsonParse[$url[decode;$httpResult[Accounts]]]
  183.   $if[$jsonExists[$var[username]]==false]
  184. $ephemeral
  185. $removeAllComponents
  186. $addField[Failed;This username does not exist.]
  187. $color[2b2d31]
  188. $stop
  189.   $elseif[$json[$var[username];Pass]!=$var[pass]]
  190. $ephemeral
  191. $removeAllComponents
  192. $addField[Failed; Incorrect password.]
  193. $color[2b2d31]
  194. $stop
  195.   $elseif[$jsonArrayCount[$var[username];Users]>=10]
  196. $ephemeral
  197. $removeAllComponents
  198. $addField[Failed;This account has reached the maximum users that can be connected to one account which is 10 users.]
  199. $color[2b2d31]
  200. $stop  
  201.   $else
  202. $jsonArrayAppend[$var[username];Users;"$authorID"]
  203. $httpPost[http://api.walat.uk/set_variable/$botID/Accounts;{"password" : "$var[walatpass]","value" : "$url[encode;$jsonStringify]"}]
  204. $var[AccID;$json[$var[username];AccID]]
  205. $var[Pass;$json[$var[username];Pass]]
  206. $var[Date;$json[$var[username];Date]]
  207. $jsonParse[{}]
  208. $jsonSetString[Username;$var[username]]
  209. $jsonSetString[Pass;$var[Pass]]
  210. $jsonSetString[Date;$var[Date]]
  211. $jsonSetString[AccID;$var[AccID]]
  212. $setVar[Acc;$jsonStringify;$authorID]
  213. $removeButtons
  214. $color[2b2d31]
  215. $addField[Logged In;Successfully logged into the account $var[username].]
  216.   $endif
  217. $endif
  218. $if[$var[customID]==acc.logout]
  219.  $if[$var[authorID]!=$authorID]
  220.  $ephemeral
  221.  $removeAllComponents
  222.  $addField[Error;You are not the author of this command]
  223.  $color[2b2d31]
  224.  $stop
  225.  $endif
  226. $author[$username]
  227. $authorIcon[$authorAvatar]
  228. $color[2b2d31]
  229. $addField[Confirm;Are you sure you want to logout?]
  230. $removeButtons
  231. $addButton[no;acc.logout.yes+$authorID;Yes;success]
  232. $addButton[no;acc.logout.no+$authorID;No;danger]
  233. $addButton[no;delete+$authorID;Close;danger]
  234. $endif
  235. $if[$var[customID]==acc.logout.no]
  236.  $if[$var[authorID]!=$authorID]
  237.  $ephemeral
  238.  $removeAllComponents
  239.  $addField[Error;You are not the author of this command]
  240.  $color[2b2d31]
  241.  $stop
  242.  $endif
  243. $removeButtons
  244. $author[$username]
  245. $authorIcon[$authorAvatar]
  246. $color[2b2d31]
  247. $addField[Cancelled;You have successfully cancelled the logout]
  248. $endif
  249. $if[$var[customID]==acc.logout.yes]
  250.  $if[$var[authorID]!=$authorID]
  251.  $ephemeral
  252.  $removeAllComponents
  253.  $addField[Error;You are not the author of this command]
  254.  $color[2b2d31]
  255.  $stop
  256.  $endif
  257. $removeButtons
  258. $author[$username]
  259. $authorIcon[$authorAvatar]
  260. $color[2b2d31]
  261. $addField[Done;You have successfully logged out from your account]
  262. $try
  263. $jsonParse[$getVar[Acc;$authorID]]
  264. $var[username;$json[Username]]
  265. $httpPost[http://api.walat.uk/get_variable/$botID/Accounts;{"password" : "$var[walatpass]"}]
  266. $jsonParse[$url[decode;$httpResult[Accounts]]]
  267.   $if[$jsonExists[$var[username]]==true]
  268. $jsonUnset[$var[username];Users;$jsonArrayIndex[$var[username];Users;"$authorID"]]
  269. $httpPost[http://api.walat.uk/set_variable/$botID/Accounts;{"password" : "$var[walatpass]","value" : "$url[encode;$jsonStringify]"}]
  270.   $endif
  271. $endtry
  272. $setVar[Acc;{};$authorID]
  273. $endif
  274. $if[$var[customID]==acc.delete]
  275.  $if[$var[authorID]!=$authorID]
  276.  $ephemeral
  277.  $removeAllComponents
  278.  $addField[Error;You are not the author of this command]
  279.  $color[2b2d31]
  280.  $stop
  281.  $endif
  282. $author[$username]
  283. $authorIcon[$authorAvatar]
  284. $color[2b2d31]
  285. $addField[Confirm;Are you sure you want to delete this account?]
  286. $removeButtons
  287. $addButton[no;acc.delete.yes+$authorID;Yes;success]
  288. $addButton[no;acc.delete.no+$authorID;No;danger]
  289. $addButton[no;delete+$authorID;Close;danger]
  290. $endif
  291. $if[$var[customID]==acc.delete.no]
  292.  $if[$var[authorID]!=$authorID]
  293.  $ephemeral
  294.  $removeAllComponents
  295.  $addField[Error;You are not the author of this command]
  296.  $color[2b2d31]
  297.  $stop
  298.  $endif
  299. $removeButtons
  300. $author[$username]
  301. $authorIcon[$authorAvatar]
  302. $color[2b2d31]
  303. $addField[Cancelled;You have successfully cancelled the deletion of the account]
  304. $endif
  305. $if[$var[customID]==acc.delete.yes]
  306.  $if[$var[authorID]!=$authorID]
  307.  $ephemeral
  308.  $removeAllComponents
  309.  $addField[Error;You are not the author of this command]
  310.  $color[2b2d31]
  311.  $stop
  312.  $endif
  313. $removeButtons
  314. $author[$username]
  315. $authorIcon[$authorAvatar]
  316. $color[2b2d31]
  317. $addField[Verify;Enter your password to delete the account.]
  318. $addButton[no;acc.delete.verify+$authorID;Enter Password;success]
  319. $endif
  320. $if[$var[customID]==acc.delete.verify]
  321.  $if[$var[authorID]!=$authorID]
  322.  $ephemeral
  323.  $removeAllComponents
  324.  $addField[Error;You are not the author of this command]
  325.  $color[2b2d31]
  326.  $stop
  327.  $endif
  328. $newModal[acc.delete.verify.modal;Account Deletion]
  329. $addTextInput[pass;short;Password;6;8;yes;$var[pass];Pass123@]
  330. $endif
  331. $if[$var[customID]==acc.delete.verify.modal]
  332. $jsonParse[$getVar[Acc;$authorID]]
  333. $var[pass;$json[Pass]]
  334. $var[username;$json[Username]]
  335.   $if[$var[pass]!=$input[pass]]
  336. $addField[Error; Invalid Password]
  337. $color[2b2d31]
  338.   $elseif[$var[pass]==$input[pass]]
  339. $removeButtons[$messageID]
  340. $addField[Done;You have successfully deleted your account]
  341. $color[2b2d31]
  342. $setVar[Acc;{};$authorID]
  343. $try
  344. $httpPost[http://api.walat.uk/get_variable/$botID/Accounts;{"password" : "$var[walatpass]"}]
  345. $jsonParse[$url[decode;$httpResult[Accounts]]]
  346. $jsonUnset[$var[username]]
  347. $httpPost[http://api.walat.uk/set_variable/$botID/Accounts;{"password" : "$var[walatpass]","value" : "$url[encode;$jsonStringify]"}]
  348. $endtry
  349.   $endif
  350. $endif
  351. $if[$var[customID]==acc.forgot.password]
  352.  $if[$var[authorID]!=$authorID]
  353.  $ephemeral
  354.  $removeAllComponents
  355.  $addField[Error;You are not the author of this command]
  356.  $color[2b2d31]
  357.  $stop
  358.  $endif
  359. $ephemeral
  360. $removeButtons
  361. $color[2b2d31]
  362. $author[$username]
  363. $authorIcon[$authorAvatar]
  364. $addField[Sorry;Unfortunately we can't remember it for you so try to remember it next time. and yes you will never be able to get the information in that account]
  365. $endif
  366. $if[$var[customID]==acc.change.password]
  367.  $if[$var[authorID]!=$authorID]
  368.  $ephemeral
  369.  $removeAllComponents
  370.  $addField[Error;You are not the author of this command]
  371.  $color[2b2d31]
  372.  $stop
  373.  $endif
  374.  $newModal[acc.change.password.modal;Changing Password]
  375. $addTextInput[oldpass;short;Current Password;6;8;yes;;Pass123@]
  376. $addTextInput[newpass;short;New Password;6;8;yes;;Pass123@]
  377. $endif
  378. $if[$var[customID]==acc.change.password.modal]
  379. $jsonParse[$getVar[Acc;$authorID]]
  380. $var[oldPass;$json[Pass]]
  381. $var[username;$json[Username]]
  382.   $if[$checkContains[$input[newpass];1;2;3;4;5;6;7;8;9;0]==false]
  383. $ephemeral
  384. $removeAllComponents
  385. $color[2b2d31]
  386. $addField[Invalid New Password Input;You must enter a number in your password]
  387.   $elseif[$checkContains[$input[newpass];+;-;.;~]==true]
  388. $ephemeral
  389. $removeAllComponents
  390. $color[2b2d31]
  391. $addField[Invalid New Password Input;You can not use +,-,.,~ symbols in your password]
  392.   $elseif[$var[oldPass]!=$input[oldpass]]
  393.   $ephemeral
  394. $removeAllComponents
  395. $color[2b2d31]
  396. $addField[Failed;Invalid current password input.]
  397.   $else
  398. $httpPost[http://api.walat.uk/get_variable/$botID/Accounts;{"password" : "$var[walatpass]"}]
  399. $jsonParse[$url[decode;$httpResult[Accounts]]]
  400.     $if[$jsonExists[$var[username]]==false]
  401. $ephemeral
  402. $removeAllComponents
  403. $addField[Failed;This username does not exist.]
  404. $color[2b2d31]
  405. $stop
  406.     $elseif[$json[$var[username];Pass]!=$input[oldpass]]
  407. $ephemeral
  408. $removeAllComponents
  409. $addField[Failed; Incorrect password.]
  410. $color[2b2d31]
  411. $stop
  412.     $else
  413. $jsonSetString[$var[username];Pass;$input[newpass]]
  414. $httpPost[http://api.walat.uk/set_variable/$botID/Accounts;{"password" : "$var[walatpass]","value" : "$url[encode;$jsonStringify]"}]
  415. $var[Pass;$json[$var[username];Pass]]
  416. $jsonParse[$getVar[Acc;$authorID]]
  417. $jsonSetString[Pass;$input[newpass]]
  418. $setVar[Acc;$jsonStringify;$authorID]
  419. $removeButtons
  420. $color[2b2d31]
  421. $author[$username]
  422. $authorIcon[$authorAvatar]
  423. $addField[Success;Successfully changed the password]
  424.     $endif
  425.   $endif
  426. $endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement