options: #Command used to link players, can be changed to anything as long as it doesn't conflict with other scripts! command: linkapi #Base permission name (THIS_PART_HERE.blablabla) perm: linkapi #I think it looks obvious... perm-message: &4Insufficient permission! #!Name of the discord bot to register bot: LinkAPI #!Bot's token bot-token: TOKEN_GOES_HERE #Discord command prefix bot-prefix: * function user(id: string): if user with id "%{_id}%" is not set: retrieve user with id "%{_id}%" on skript load: login to "{@bot-token}" with name "{@bot}" command /{@command} [] []: permission: {@perm}.use permission message: "{@perm-message}" usage: "&cUsage: /{@command} " executable by: player and console trigger: if arg-1 is "link": if player has permission "{@perm}.link": if {discord::%uuid of player%::linked} is set: send "&4You have already linked your account, if you want to link a different one, use " to player else if {code::%uuid of player%} is not set: set {_code} to random integer between 100000 and 999999 set {code::%uuid of player%} to {_code} send "&2Your code to link is &f&l%{code::%uuid of player%}%" to player wait 5 minutes delete {code::%uuid of player%} else: send "&4Your code is &c%{code::%uuid of player%}%&4, so you don't need to generate another one!" to player else if arg-1 is "unlink": if player has permission "{@perm}.unlink" if {discord::%uuid of player%::linked} is not set: send "&4You can't unlink from nobody, can you?" else: retrieve user with id "%{discord::%uuid of arg-2%::linked}%" and store them in {_user} send "&2Unlinked your account from %{_user}%&2##%discriminator of {_user}%!" delete {discord::%uuid of player%::linked} else if arg-1 is "linked": if player has permission "{@perm}.linked" if arg-2 is set: if {discord::%uuid of arg-2%::linked} is set: retrieve user with id "%{discord::%uuid of arg-2%::linked}%" and store them in {_user} send "&6%arg-2% &6is linked to %{_user}%&6##%discriminator of {_user}%" else: send "&4%arg-2% &4isn't linked to any account" else: send "&4Please specify a Player" discord command {@bot-prefix}link [] []: executable in: guild bots: {@bot} trigger: delete event-message if arg 1 is not set: send ":x: Please input player to link your account to!" to event-channel with event-bot and store it in {_message} set {_id} to discord id of {_message} wait 5 seconds delete {_message} stop if arg-2 is not set: send ":x: Please input your verification code, if you do not have one type /{@command} link ingame" to event-channel with event-bot and store it in {_message} set {_id} to discord id of {_message} wait 5 seconds delete {_message} stop if {code::%uuid of arg 1%} is not set: reply with ":x: Please type /discord link ingame to get your verification code" wait 5 seconds delete {_message} stop if {code::%uuid of arg 1%} = arg 2: set {discord::%uuid of arg-1%::linked} to discord id of event-member send ":white_check_mark: Your minecraft account: %arg-1% has been linked to your Discord account!" to event-channel with event-bot and store it in {_message} set {_id} to discord id of event-member send "&6Your account is now linked to &a%discord name of user with id {_id}%&a##%discriminator of user with id {_id}%" to arg-1 delete {code::%uuid of arg-1%} wait 5 seconds delete {_message} stop else: reply with ":x: Wrong code!"