Help with how forking works

Question:how to make it so when someone forks my repl it tells them to credit me if they post something using my code?

Repl link:https://replit.com/@Xxketergreen/Script-center?v=1

code snippet: 

Wish I would help but I have no idea maybe @QwertyQwerty54 can help you.

Welcome to thte commutiy, @Xxketergreen! Whenever someone forks your repl, it shows it.
image

3 Likes

@Xxketergreen When someone forks your Repl, the new Repl will automatically have the text “Forked from <user> / <repl>”, see @JayAySeaOhBee14’s comment.

1 Like

Yes. Exactly. That means the people viewing it will be able to see who created it originally, if the want to. Most of the time though, none of us pay attention to it unless it a big color banner in the way of our viewing port.

1 Like

i know, but what i mean is only if someone forked it it will tell the to credit me if they use the code in a different repl

You can just do a comment in the code, and the discription of the repl

1 Like

i know but i want something fancy

Bruh what do you mean :expressionless:

like it would display in console a message but only if it was forked

@Xxketergreen A cool feature of Repl is their Secrets. A rule of their Secrets is when someone forks your Repl, the secret is deleted, that’s how the next part works:
Open a new Secrets tab in your Repl. Make a Secret. It can literally be anything and it should have a value.
Add import os to the top of your file.
Add this to your file:

if os.getenv("SECRET_NAME") == None:
    print("Originally created by USERNAME")
else:
    pass

You can figure out the rest.

(P.S.: If this solves your problem, then set this to the solution of this post)
3 Likes

That’s a really neat idea @lightdefusion . Thanks for sharing and I think this is maybe the solution?

@Xxketergreen if you don’t want users to fork your code I would recommend making those Repls private, however it’s great to share!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.