Ask coding questions

← Back to all posts
repl site name programatically? (in js)
TikiHed (4)

trying to get the repl site name programatically?(in js)... i.e. https://my_repl_name_here.xiija.repl.co/

thanx for any ....

Answered by EpicGamer007 (1736) [earned 5 cycles]
View Answer
Comments
hotnewtop
EpicGamer007 (1736)
const url = `${process.env.REPL_SLUG}.${process.env.REPL_OWNER}.repl.co`
TikiHed (4)

Thanks, this works great ...
Now i can log which repl my bot is coming from ...
https://${ process.env.REPL_SLUG }.${ process.env.REPL_OWNER }.repl.co/

CodeLongAndPros (1624)

What do you mean "repl site name"?
You can make example repls and find the mapping for the names and then:
{name}.{user}.repl.co