Is there a way to get the username of an account that runs a repl and store it?
I am trying to make a log of users that run my repl. How would I do it? I have looked all over but no answers?
Can you help me?
You can do:
import os
os.environ['REPL_OWNER']
even if it says repl owner, it shows the name of the person who runs it.
Also i realised that @Atomic-Gamming asked this 2 years ago...
@RithvikKandula1 ya, its been quite a bit
from os import environ
username = environ["REPL_OWNER"]
@didlly That only finds the name of the repl owner. Is there a different key for the user? using "USER" makes the variable equal "runner".
@neocryptixalt No, this get's the name of the user running to the repl, contrary to it's name. If you don't believe me run this repl: https://replit.com/@didlly/Username?v=1
@didlly does this only work if you're not an editor? When I run one of my mutiplayer repls, it always prints the name of the owner, not me. I also tried running it from a spotlight page, still didn't work.
EDIT: your repl works, but it the code doesn't work when I import it into mine.
@neocryptixalt Uh, I don't know why that happens. It works fine for me.
@neocryptixalt works for me!
@neocryptixalt It's probably because you're the owner so it's printing your name
@CadenC1 no its printing the owner of the repl's name (not me.)
@neocryptixalt must not work for you, never had that happen
This doesn't have to do with the username thing, but you don't have to type MULTIPLE lines that say, "print()". You can use ONE print() function by using a multi line string:
'''
TEXT GOES HERE
'''
It is possible, https://replit.com/@RayhanADev/NodeJS-Virus check out this repl(not a virus) by rayhanadev
@JamesGordon1
This isn't possible because repl.it doesn't provide a way for you to get the usernames of people running your code. Not sure why this feature would be useful tho.
@ash15khng idk, finding how many times a certain user clicked a certain button on your site?
@ash15khng Keeping track of high scores?
@ash15khng it was to log who ever ran the beta version on a program so I could give them credit and log who sent feedback if they did send any, but that doesn't matter now
This is not currently possible on repl.it
@Vandesm14 ok :(