Advertisement
StaffVanish

BDFD - AFK Command

Feb 1st, 2024
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | Source Code | 0 0
  1. - Variable : afk
  2. * Value:
  3. {
  4. "status" : false,
  5. "reason" : "",
  6. "time" : 0,
  7. "nickname" : ""
  8. }
  9.  
  10. 1. Trigger: a-Z, 0-9, special character (?!+$ etc..)
  11. Scripting Language: BDScript 2
  12. Code:
  13. $nomention $c[Code Made By @deruuyo#0000] $suppressErrors $awaitFunc[afk] $awaitFunc[command]
  14.  
  15. 2. Trigger: $awaitedCommand[command;]
  16. Scripting Language: BDScript 2
  17. Code:
  18. $nomention $c[Code Made By @deruuyo#0000] $suppressErrors $awaitFunc[afk] $awaitFunc[command]
  19.  
  20. 3. Trigger: $awaitedCommand[afk;]
  21. Scripting Language: BDScript 2
  22. Code:
  23. $nomention $awaitFunc[web] $awaitFunc[test] $suppressErrors $allowMention $c[Code Made By @deruuyo#0000]
  24.  
  25. $c[Get userID by replied message or mentioned]
  26. $var[user;$trimSpace[$if[$repliedMessageID!=]$if[$authorOfMessage[$channelID;$repliedMessageID]!=$authorID]$authorOfMessage[$channelID;$repliedMessageID]$endif $else $findUser[$mentioned[1];no]$endif]]
  27.  
  28. $c[Check if user is valid]
  29. $if[$var[user]!=]
  30.  
  31. $c[Get the afk data]
  32. $jsonParse[$getUserVar[afk;$var[user]]]
  33. $jsonSet[time;$trimSpace[$if[$or[$json[time]<=0;$json[time]==]]**Undefined**$else <t:$json[time]:R>$endif ]]
  34. $jsonSet[reason;$trimSpace[$if[$json[reason]==]**AFK**$else $json[reason]$endif ]]
  35.  
  36. $c[Send a replied message to author, if that user are AFK]
  37. $if[$json[status]==true]
  38. $botTyping $reply $username[$var[user]]#$discriminator[$var[user]] is afk for $json[time] with reason: $json[reason] $suppressErrors $deleteIn[1m]
  39. $endif
  40.  
  41. $c[Author AFK Check]
  42. $else
  43.  
  44. $c[Get the afk data]
  45. $jsonParse[$getUserVar[afk;$authorID]]
  46. $jsonSet[time;$trimSpace[$if[$or[$json[time]<=0;$json[time]==]]**Undefined**$else <t:$json[time]:R>$endif ]]
  47. $jsonSet[reason;$trimSpace[$if[$json[reason]==]**AFK**$else $json[reason]$endif ]]
  48. $jsonSet[nickname;$trimSpace[$if[$json[nickname]==]$if[$displayName[$authorID]!=]$displayName[$authorID]$else $username$endif $else $json[nickname]$endif ]]
  49.  
  50. $c[Send a replied message, if author is AFK]
  51. $if[$json[status]==true]
  52. $botTyping $reply Welcome back <@$authorID>, you're afk for $json[time] with reason: $json[reason]
  53. $setUserVar[afk;$getVar[afk];$authorID]
  54. $c[Try change author nickname, if author have a nickname before]
  55. $try $changeUsernameWithID[$authorID;$json[nickname]] $endtry
  56. $endif
  57. $endif
  58.  
  59. 4. Trigger: ?afk
  60. Scripting Language: BDScript 2
  61. Code:
  62. $nomention $botTyping $reply $jsonParse[$getUserVar[afk]]
  63. $c[Code Made By @deruuyo#0000]
  64.  
  65. $c[If author already afk before]
  66. $if[$json[status]]
  67. You already set afk status
  68.  
  69. $c[If author aren't afk]
  70. $else
  71.  
  72. $c[Temp var for reason to afk]
  73. $var[r;$replaceText[$replaceText[%$var[msg]%;%%;AFK];%$var[msg]%;$cropText[$var[msg];1000;...]]]
  74.  
  75. $c[Send the message]
  76. I set your afk to: $var[r]
  77.  
  78. $c[Set the afk data]
  79. $jsonSet[status;true]$jsonSet[reason;$var[r]]$jsonSetString[time;$getTimestamp]
  80. $jsonSet[nickname;$cropText[$nickname[$authorID];25;...]]
  81. $setUserVar[afk;$jsonPretty[1];$authorID]
  82. $c[Set author nickname to AFK]
  83. $try $changeUsernameWithID[$authorID;[AFK\] $cropText[$nickname;20;]]$endtry
  84.  
  85. $endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement