Skip to content

Instantly share code, notes, and snippets.

@brecert
Created April 10, 2018 19:18
Show Gist options
  • Save brecert/9d2f5d0fe7808b69f1a8978e909c425a to your computer and use it in GitHub Desktop.
Save brecert/9d2f5d0fe7808b69f1a8978e909c425a to your computer and use it in GitHub Desktop.
$${
STRIP(&schat,%CHAT%)
ifmatches(%CHAT%,"§k")
log("%&schat%")
endif;
#ratelimit = %TIMESTAMP% - %#ratelimitlast%
if(%#ratelimit% > 2)
// Get User Info
ifmatches(%&schat%,"");
match(%&schat%,"(\S+)?",&user,1);
// LOG(%&user%);
endif;
ifmatches(%&schat%,"!respawn");
respawn();
echo("Respawned");
endif;
//If public release, then make @Bre %DISPLAYNAME% and remove Bre]
ifmatches(%&schat%,"@Bre|Bre?\]");
//TOAST("tutorial","keys","%&user%","%&schat%")
//@&lastmention = %CHAT%
PUSH(@&mentionlast[],%CHAT%);
PUSH(@&mentiondate[],%TIMESTAMP%);
//LOG(%@&lastmention%[2])
PLAYSOUND(entity.arrow.hit_player);
endif;
//If public release, then make @Bre %DISPLAYNAME% and remove Bre]
ifmatches(%&schat%,"tells you|whispers to you");
PUSH(@&tellast[],%CHAT%);
PUSH(@&telldate[],%TIMESTAMP%);
PLAYSOUND(entity.arrow.hit_player);
endif;
//@&code = "0290"
// Chat command !chat [#code] [*message]
ifmatches(%&schat%,"!chat");
#ratelimitlast = %TIMESTAMP%
//SET(@timer);
ifmatches(%&schat%,%@#code%);
match(%&schat%,"!chat %@#code% ([\w\W]{1,})",&mat,1);
ifmatches(%&mat%,\/pay)
stop;
endif;
ECHO(%&mat%);
WAIT(10t);
LOG(%&user% said the thing above ^);
endif;
endif;
ifmatches(%&schat%,"!time");
#ratelimitlast = %TIMESTAMP%
echo(%TIME%)
endif;
ifmatches(%&schat%,"!congrats");
#ratelimitlast = %TIMESTAMP%
echo(Congrats!)
endif;
ifmatches(%&schat%,"!ping");
#ratelimitlast = %TIMESTAMP%
echo(Pong!)
endif;
ifmatches(%&schat%,"!get");
#ratelimitlast = %TIMESTAMP%
match(%&schat%,"!get ([\w\W]{1,})",&user,1);
&url = "https://api.mojang.com/users/profiles/minecraft/%&user%?at=%TIMESTAMP%"
&response = HTTPGET(%&url%,"","")
//log(/minecraft:me » %&response%)
&json[] = SPLIT(",",%&response%)
MATCH(%&json[0]%,\"id\":\"([a-z|0-9]+)\",{&uuid})
&responsenames = HTTPGET("https://api.mojang.com/user/profiles/%&uuid%/names","","")
&namesarray[] = SPLIT("},{",%&responsenames%)
ARRAYSIZE(&namesarray,#size)
#sizeabsolute = ((%#size%) - 1)
MATCH(%&namesarray[0]%,^\[?\{\"name\":\"(.*)\",{&originalname})
echo("&6Original name: &a%&originalname%")
echo("&6Name changed %#sizeabsolute% times.")
wait(5t)
IF(#size > 1)
MATCH(%&namesarray[%#sizeabsolute%]%,^\[?\{?\"name\":\"(.*)\"\,\"changedToAt\":\d+\}\]$,{&currentname})
echo("&6Current name: &a%&currentname%")
&previousname = %&originalname%
FOR(#for,1,%#sizeabsolute%)
MATCH(%&namesarray[%#for%]%,^\[?\{?\"name\":\"(.*)\"\,\"changedToAt\":\d+\}?\]?$,{&changedname})
echo("&a%&previousname% &6to &a%&changedname%")
&previousname = %&changedname%
wait(4t)
NEXT
ENDIF
endif;
ifmatches(%&schat%,"!eval");
#ratelimitlast = %TIMESTAMP%
//SET(@timer);
ifmatches(%&schat%,%@#code%);
match(%&schat%,"!eval %@#code% (.+)",&ev,1);
%&mat%
endif;
endif;
// Chat command !help [?&command]
ifmatches(%&schat%,"!help");
log("got !help");
ifmatches(%&schat%,"(tells|whispers)\s?(to)?\syou)";
match(%&schat%,"!help !?(\S+)",&helps,1);
log(got helps: %&helps%);
else;
stop;
endif;
UNSET(&chelp1);
UNSET(&chelp2);
UNSET(&chelp3);
if(%&helps% = "chat");
SET(&chelp1,"!chat [#code] [*message]");
SET(&chelp2,"Lets the message passed through, be chatted through the owner.");
SET(&chelp3,"Ex. !chat 000 This is a message.");
endif;
echo(/tell %&user% %&chelp1%);
echo(/tell %&user% %&chelp2%);
//echo(/tell %&user% %&chelp3%);
endif;
}$$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment