-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandsome.ts
80 lines (68 loc) · 2.24 KB
/
handsome.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env deno run --unstable --allow-env --allow-run --allow-net --allow-read --allow-write --allow-ffi
import axios from "axios"
import { Client } from "https://deno.land/x/discord_rpc/mod.ts";
const client = new Client({
id: "781057233931862016",
});
await client.connect();
var ROBLOSECURITY = ""
let getstatus = async (userid) => {
let result = await axios({
method: "POST",
url: "https://presence.roblox.com/v1/presence/users",
data: {
"userIds": [userid]
},
headers: {
"Cookie": `.ROBLOSECURITY=${ROBLOSECURITY}`
}})
console.log(result.data)
return result.data.userPresences[0]
}
let getplaceicon = async (universeid) => {
try {
let result = await axios.get(`https://thumbnails.roblox.com/v1/games/icons?universeIds=${universeid}&size=512x512&format=Png&isCircular=false`)
return result.data.data[0].imageUrl
} catch (err) {
console.log(err)
}
}
function startRPC(rpc,uid){
setInterval(async () => {
let result = await getstatus(uid)
if (result.userPresenceType == 1 ) {
await rpc.setActivity({
details: "On Website",
state: "Browsing",
assets: {
"large_image": "https://cdn.discordapp.com/attachments/851763489944109096/1143148217450647552/6294eb0b4609037792ef36f2.png"
}
});
} else if(result.userPresenceType == 2) {
let icon = await getplaceicon(result.universeId)
await rpc.setActivity({
details: result.lastLocation,
state: "Playing",
assets: {
"large_image": icon,
"large_text": "BloxRPC"
},
buttons: [
{
label: "Join Game",
url: `https://roblox.com/games/${result.placeId}`
}
]
})
} else {
await rpc.setActivity({
details: "On App",
state: "Browsing",
assets: {
"large_image": "https://cdn.discordapp.com/attachments/851763489944109096/1143148217450647552/6294eb0b4609037792ef36f2.png"
}
});
}
},5000)
}
startRPC(client,"Roblock ID ")