Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - Variable : afk
- * Value:
- {
- "status" : false,
- "reason" : "",
- "time" : 0,
- "nickname" : ""
- }
- 1. Trigger: a-Z, 0-9, special character (?!+$ etc..)
- Scripting Language: BDScript 2
- Code:
- $nomention $c[Code Made By @deruuyo#0000] $suppressErrors $awaitFunc[afk] $awaitFunc[command]
- 2. Trigger: $awaitedCommand[command;]
- Scripting Language: BDScript 2
- Code:
- $nomention $c[Code Made By @deruuyo#0000] $suppressErrors $awaitFunc[afk] $awaitFunc[command]
- 3. Trigger: $awaitedCommand[afk;]
- Scripting Language: BDScript 2
- Code:
- $nomention $awaitFunc[web] $awaitFunc[test] $suppressErrors $allowMention $c[Code Made By @deruuyo#0000]
- $c[Get userID by replied message or mentioned]
- $var[user;$trimSpace[$if[$repliedMessageID!=]$if[$authorOfMessage[$channelID;$repliedMessageID]!=$authorID]$authorOfMessage[$channelID;$repliedMessageID]$endif $else $findUser[$mentioned[1];no]$endif]]
- $c[Check if user is valid]
- $if[$var[user]!=]
- $c[Get the afk data]
- $jsonParse[$getUserVar[afk;$var[user]]]
- $jsonSet[time;$trimSpace[$if[$or[$json[time]<=0;$json[time]==]]**Undefined**$else <t:$json[time]:R>$endif ]]
- $jsonSet[reason;$trimSpace[$if[$json[reason]==]**AFK**$else $json[reason]$endif ]]
- $c[Send a replied message to author, if that user are AFK]
- $if[$json[status]==true]
- $botTyping $reply $username[$var[user]]#$discriminator[$var[user]] is afk for $json[time] with reason: $json[reason] $suppressErrors $deleteIn[1m]
- $endif
- $c[Author AFK Check]
- $else
- $c[Get the afk data]
- $jsonParse[$getUserVar[afk;$authorID]]
- $jsonSet[time;$trimSpace[$if[$or[$json[time]<=0;$json[time]==]]**Undefined**$else <t:$json[time]:R>$endif ]]
- $jsonSet[reason;$trimSpace[$if[$json[reason]==]**AFK**$else $json[reason]$endif ]]
- $jsonSet[nickname;$trimSpace[$if[$json[nickname]==]$if[$displayName[$authorID]!=]$displayName[$authorID]$else $username$endif $else $json[nickname]$endif ]]
- $c[Send a replied message, if author is AFK]
- $if[$json[status]==true]
- $botTyping $reply Welcome back <@$authorID>, you're afk for $json[time] with reason: $json[reason]
- $setUserVar[afk;$getVar[afk];$authorID]
- $c[Try change author nickname, if author have a nickname before]
- $try $changeUsernameWithID[$authorID;$json[nickname]] $endtry
- $endif
- $endif
- 4. Trigger: ?afk
- Scripting Language: BDScript 2
- Code:
- $nomention $botTyping $reply $jsonParse[$getUserVar[afk]]
- $c[Code Made By @deruuyo#0000]
- $c[If author already afk before]
- $if[$json[status]]
- You already set afk status
- $c[If author aren't afk]
- $else
- $c[Temp var for reason to afk]
- $var[r;$replaceText[$replaceText[%$var[msg]%;%%;AFK];%$var[msg]%;$cropText[$var[msg];1000;...]]]
- $c[Send the message]
- I set your afk to: $var[r]
- $c[Set the afk data]
- $jsonSet[status;true]$jsonSet[reason;$var[r]]$jsonSetString[time;$getTimestamp]
- $jsonSet[nickname;$cropText[$nickname[$authorID];25;...]]
- $setUserVar[afk;$jsonPretty[1];$authorID]
- $c[Set author nickname to AFK]
- $try $changeUsernameWithID[$authorID;[AFK\] $cropText[$nickname;20;]]$endtry
- $endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement