Skip to content

Commit 34b987a

Browse files
authored
main skript added
added the skript itself
1 parent a4f0aa3 commit 34b987a

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

DiSKy-skript-link.sk

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
options:
2+
prefix: '&7[&bDiscord&7]&r'
3+
4+
command /link:
5+
aliases: /discord
6+
permission: link.discord
7+
trigger:
8+
if player has permission "link.discord":
9+
execute console command "discord link %player%"
10+
11+
command /unlink:
12+
aliases: /discord unlink
13+
permission: unlink.discord
14+
trigger:
15+
if player has permission "unlink.discord":
16+
execute console command "discord unlink %player%"
17+
18+
on discord command:
19+
description: Link your Minecraft account to your Discord account
20+
usage: /link <code>
21+
trigger:
22+
if arg-1 is not set:
23+
reply with "&cUsage: /link <code>"
24+
stop
25+
set {link.code.%discord id of user%} to random integer between 1000 and 9999
26+
if {link.code.%discord id of user%} is in {linked.players}:
27+
set {link.code.%discord id of user%} to random integer between 1000 and 9999
28+
set {linked.players::%{link.code.%discord id of user%}%} to player
29+
set {linked.players.%player%} to {link.code.%discord id of user%}
30+
execute console command "discord verify %discord id of user% {link.code.%discord id of user%}"
31+
wait 3 seconds
32+
if {verified} is not set:
33+
reply with "&cCould not verify your Discord account."
34+
stop
35+
set {_number} to {link.code.%discord id of user%}
36+
execute console command "tellraw %player% {\"text\":\"Your code is \",\"color\":\"yellow\"}"
37+
execute console command "tellraw %player% {\"text\":\"%{_number}%\",\"color\":\"green\"}"
38+
set {_discord_nick} to "{displayname}"
39+
execute console command "nick %player% to %player's name%"
40+
execute console command "discord link %player% to %discord id of user%"
41+
broadcast "&a%{_discord_nick}% &7has linked their Discord account to their Minecraft account and received a reward!"
42+
# Add your reward here
43+
44+
on discord unlink:
45+
description: Unlink your Minecraft account from your Discord account
46+
trigger:
47+
if {linked.players.%player%} is set:
48+
set {discord.id} to discord id of user
49+
delete {link.code.%discord.id%}
50+
delete {linked.players::%{linked.players.%player%}%}
51+
delete {linked.players.%player%}
52+
execute console command "discord unlink %player%"
53+
broadcast "&c%player% &7has unlinked their Discord account from their Minecraft account."
54+
else:
55+
reply with "&cYour Minecraft account is not linked to a Discord account."

0 commit comments

Comments
 (0)