Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lanylastseen

Watches your Discord presence over the Lanyard websocket and writes a lastseen timestamp to your Lanyard KV store whenever you go offline.

Requirements

  • Node.js 18 or newer
  • A Lanyard API key: join the Lanyard Discord server, then DM Lanyard#5766 and send .apikey to get it
  • Your Discord user ID with the Lanyard bot present in a shared server (Lanyard only tracks presence for users in a server it's in)

Setup

git clone https://github.com/sleepingcat1714/lanylastseen
cd lanylastseen
npm install

Create a .env file in the folder:

user_id=
token=
ws_url=wss://api.lanyard.rest/socket
kv_key=lastseen
time_format=0
discord_timestamp_style=6

All of these must be set.

  • user_id - your Discord user ID
  • token - your Lanyard API token
  • ws_url - Lanyard websocket URL (change if self-hosting Lanyard)
  • kv_key - KV key to write the timestamp to
  • time_format / discord_timestamp_style - see Timestamp format below

Then:

npm start

Timestamp format

The time_format is how the lastseen value gets written:

time_format Format
0 Epoch milliseconds (default)
1 Epoch seconds
2 ISO 8601
3 Discord timestamp markdown (<t:seconds:style>)
4 Readable plain text

When time_format=3, discord_timestamp_style picks the Discord markdown style:

discord_timestamp_style Style Example
0 t short time 16:20
1 T long time 16:20:30
2 d short date 20/04/2026
3 D long date 20 April 2026
4 f short date/time 20 April 2026 16:20
5 F long date/time Tuesday, 20 April 2026 16:20
6 R relative (default) 5 minutes ago

Hosting

Install Docker first, then:

docker build -t lanylastseen .
docker run -d --name lanylastseen --env-file .env --restart unless-stopped lanylastseen

If you'd like to run with docker-compose, use this:

services:
  lanylastseen:
    build: .
    container_name: lanylastseen
    env_file: .env
    restart: unless-stopped

and start it

docker compose up -d

License

MIT see LICENSE.

About

Watches your Discord presence via Lanyard and writes a lastseen timestamp to your Lanyard KV when you go offline.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages