#Need help for my Discord Linking
1 messages · Page 1 of 1 (latest)
Lias0_0 suggests that you read this embed @simple grotto
Code blocks make it easier for helpers to identify potential errors -- help them help you!
```vb
on chat:
broadcast "This is how you format code!"
```
on chat:
broadcast "This is how you format code!"
On US keyboards, the grave character (`) is located above the tab key on the top left of the keyboard
This is my skript:
# FUNCTION: Generate a linking code
# ==========================================
function generateCode(p: player) :: string:
set {_code} to random integer between 11111 and 99999
return "%{_code}%"
# ==========================================
# ON PLAYER JOIN — Require Discord Link
# ==========================================
on join:
set {_uuid} to uuid of player
if {linked::%{_uuid}%} is not set:
set {_code} to generateCode(player)
set {link::code::%{_uuid}%} to {_code}
kick player due to "<##ff5555>%player%<##ff5555>, you are not linked to Discord!\n\n<##ffffff>Your linking code: <##55ff55>%{_code}%\n<##ffffff>Use /link %{_code}% in our Discord server to play."
stop
# ==========================================
# DISCORD COMMAND: /link <code>
# (Discord → Minecraft)
# ==========================================
discord command link:
prefixes: /
trigger:
set {_args::*} to arguments
if size of {_args::*} is not 1:
reply with "Usage: /link <code>"
stop
set {_code} to {_args::1}
loop all players:
set {_uuid} to uuid of loop-player
if {link::code::%{_uuid}%} is {_code}:
set {linked::%{_uuid}%} to true
delete {link::code::%{_uuid}%}
reply with "Your Discord is now linked to Minecraft!"
send "<##55ff55>Your Discord link has been verified!" to loop-player
stop
reply with "Invalid linking code."
stop
# ==========================================
# AUTOMATIC UNLINK WHEN USER LEAVES DISCORD
# ==========================================
on member leave:
set {_userid} to event-member's id
loop all players:
set {_uuid} to uuid of loop-player
if {linked::%{_uuid}%} is {_userid}:
delete {linked::%{_uuid}%}
send "<##ff5555>Your Discord unlink request was detected.\nYou left the server." to loop-player
kick loop-player due to "<##ff5555>You left the Discord server.\nYou must re-link to continue playing."
stop```
Done!
Okay. What is executor user supposed to do?
It works when I join to my server, the warning message works but when I link to my Discord server /link with the code is not working.
Well yeah, because you have multiple errors.
So how will it work?
After you fix the errors.
Can you help me to work this discord linking?
Sure. If you answer my question..
.
Ow, I didn't actually create this script, it was my idea but ai created this script, so I don't know what it is.
It is recommended that you don't use AI agents for multiple reasons @simple grotto:
2) Blindly trusting code from any source is a bad idea, especially on production servers. Even if the code that was generated appears to work, you have no clue what vulnerabilities it introduces or fails to protect against.
3) Using AI to write your code takes away from your learning and doesn't challenge you to develop problem solving skills.```
While AI can be used as a tool, it is necessary to understand what it is doing and check any code it creates. Since this is a learning community, we want to support your personal growth. As a result, we don't allow generated content in our help channels ([Rule 8](<#welcome-to-skunity message>))
#welcome-to-skunity message
Rule 8
Ow sorry for that...
So is there possible to help me to fix some errors in this script? It's okay if not...
You can write your own code. If you need help with that we can help you.
Can you give me some guides so I can start my own code