Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e19f11acae | |||
| 0fcd5f125c | |||
| 1316460838 |
@@ -8,5 +8,5 @@ var client = module.exports = new Discord.Client({
|
||||
|
||||
client.login(config.token).then(async () => {
|
||||
console.log("ready");
|
||||
(await client.channels.fetch(config.bot_channel))?.send('a2');
|
||||
(await client.channels.fetch(config.bot_channel))?.send('a');
|
||||
});
|
||||
|
||||
+30
-1
@@ -123,7 +123,7 @@ var commands = module.exports = [
|
||||
exec: i => commands.find(x => x.name == "steal").exec(i)
|
||||
},
|
||||
{
|
||||
name: "setbanner",
|
||||
name: "setserverbanner",
|
||||
description: "Set the server banner image",
|
||||
options: [
|
||||
{
|
||||
@@ -150,6 +150,35 @@ var commands = module.exports = [
|
||||
await i.reply(error.message);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "setservericon",
|
||||
description: "Change the server icon",
|
||||
options: [
|
||||
{
|
||||
name: "url",
|
||||
description: "HTTP(S) URL to an image",
|
||||
type: "STRING"
|
||||
}
|
||||
],
|
||||
exec: async i => {
|
||||
var url = i.options.getString("url");
|
||||
try {
|
||||
if (!url) {
|
||||
await i.guild.setIcon(null);
|
||||
await i.reply("cleared the server icon");
|
||||
} else {
|
||||
if (/^https?:\/\//i.test(url)) {
|
||||
await i.guild.setIcon(url);
|
||||
await i.reply(url);
|
||||
} else {
|
||||
await i.reply("http image url only!");
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
await i.reply(error.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
process.title = "lamp discord bot";
|
||||
process.on("unhandledRejection", error => {
|
||||
console.error("Unhandled Rejection:\n" + error.stack);
|
||||
});
|
||||
|
||||
require("dotenv").config();
|
||||
require("./vrchat");
|
||||
require("./util"); // global variables set in here
|
||||
require("./client");
|
||||
require("./discord-misc");
|
||||
require('./eval-exec');
|
||||
require('./colors');
|
||||
require('./www');
|
||||
require('./pinboard');
|
||||
require('./pixiv-embedder');
|
||||
require('./translate2');
|
||||
require('./world-clock');
|
||||
require('./buttonthing');
|
||||
require("./activitytracker");
|
||||
require("./vocabularygame");
|
||||
require("./pixiv-subscribe");
|
||||
require("./count-cmd");
|
||||
Generated
+1
-162
@@ -8,14 +8,12 @@
|
||||
"@discordjs/voice": "^0.7.5",
|
||||
"deepl": "^1.0.12",
|
||||
"discord.js": "^13.6.0",
|
||||
"dotenv": "^16.0.0",
|
||||
"express": "^4.17.1",
|
||||
"fast-average-color-node": "^1.0.3",
|
||||
"kuroshiro": "^1.2.0",
|
||||
"kuroshiro-analyzer-kuromoji": "^1.1.0",
|
||||
"libsodium-wrappers": "^0.7.9",
|
||||
"node-fetch": "^2.6.1",
|
||||
"vrchat": "^1.6.9"
|
||||
"node-fetch": "^2.6.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/runtime": {
|
||||
@@ -145,11 +143,6 @@
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/tough-cookie": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.1.tgz",
|
||||
"integrity": "sha512-Y0K95ThC3esLEYD6ZuqNek29lNX2EM1qxV8y2FTLUB0ff5wWrk7az+mLrnNFUnaXcgKye22+sFBRXOgpPILZNg=="
|
||||
},
|
||||
"node_modules/@types/ws": {
|
||||
"version": "8.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.2.tgz",
|
||||
@@ -234,23 +227,6 @@
|
||||
"follow-redirects": "^1.14.0"
|
||||
}
|
||||
},
|
||||
"node_modules/axios-cookiejar-support": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/axios-cookiejar-support/-/axios-cookiejar-support-1.0.1.tgz",
|
||||
"integrity": "sha512-IZJxnAJ99XxiLqNeMOqrPbfR7fRyIfaoSLdPUf4AMQEGkH8URs0ghJK/xtqBsD+KsSr3pKl4DEQjCn834pHMig==",
|
||||
"dependencies": {
|
||||
"is-redirect": "^1.0.0",
|
||||
"pify": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/tough-cookie": ">=2.3.3",
|
||||
"axios": ">=0.16.2",
|
||||
"tough-cookie": ">=2.3.3"
|
||||
}
|
||||
},
|
||||
"node_modules/balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
@@ -495,14 +471,6 @@
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/dotenv": {
|
||||
"version": "16.0.0",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.0.tgz",
|
||||
"integrity": "sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/doublearray": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/doublearray/-/doublearray-0.0.2.tgz",
|
||||
@@ -816,14 +784,6 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/is-redirect": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz",
|
||||
"integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/isarray": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||
@@ -1123,17 +1083,6 @@
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
||||
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
|
||||
},
|
||||
"node_modules/pify": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pify/-/pify-5.0.0.tgz",
|
||||
"integrity": "sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA==",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/prism-media": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.2.tgz",
|
||||
@@ -1176,19 +1125,6 @@
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/psl": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
|
||||
"integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ=="
|
||||
},
|
||||
"node_modules/punycode": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.7.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
|
||||
@@ -1453,19 +1389,6 @@
|
||||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/tough-cookie": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz",
|
||||
"integrity": "sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==",
|
||||
"dependencies": {
|
||||
"psl": "^1.1.33",
|
||||
"punycode": "^2.1.1",
|
||||
"universalify": "^0.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/ts-mixer": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.0.tgz",
|
||||
@@ -1488,14 +1411,6 @@
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/universalify": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
|
||||
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
|
||||
"engines": {
|
||||
"node": ">= 4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
@@ -1525,17 +1440,6 @@
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/vrchat": {
|
||||
"version": "1.6.9",
|
||||
"resolved": "https://registry.npmjs.org/vrchat/-/vrchat-1.6.9.tgz",
|
||||
"integrity": "sha512-eV3EzHtObBGIzb5tEOP6vqeZsGIlMLXybO2CwpkSDvGra2ORIoh5hYnUq9JeMnAsmwF/xMpPHrb5yg5ZPDhAoA==",
|
||||
"dependencies": {
|
||||
"@types/tough-cookie": "^4.0.1",
|
||||
"axios": "^0.21.4",
|
||||
"axios-cookiejar-support": "^1.0.1",
|
||||
"tough-cookie": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/wide-align": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
|
||||
@@ -1689,11 +1593,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"@types/tough-cookie": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.1.tgz",
|
||||
"integrity": "sha512-Y0K95ThC3esLEYD6ZuqNek29lNX2EM1qxV8y2FTLUB0ff5wWrk7az+mLrnNFUnaXcgKye22+sFBRXOgpPILZNg=="
|
||||
},
|
||||
"@types/ws": {
|
||||
"version": "8.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.2.tgz",
|
||||
@@ -1769,15 +1668,6 @@
|
||||
"follow-redirects": "^1.14.0"
|
||||
}
|
||||
},
|
||||
"axios-cookiejar-support": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/axios-cookiejar-support/-/axios-cookiejar-support-1.0.1.tgz",
|
||||
"integrity": "sha512-IZJxnAJ99XxiLqNeMOqrPbfR7fRyIfaoSLdPUf4AMQEGkH8URs0ghJK/xtqBsD+KsSr3pKl4DEQjCn834pHMig==",
|
||||
"requires": {
|
||||
"is-redirect": "^1.0.0",
|
||||
"pify": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
@@ -1966,11 +1856,6 @@
|
||||
"ws": "^8.4.0"
|
||||
}
|
||||
},
|
||||
"dotenv": {
|
||||
"version": "16.0.0",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.0.tgz",
|
||||
"integrity": "sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q=="
|
||||
},
|
||||
"doublearray": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/doublearray/-/doublearray-0.0.2.tgz",
|
||||
@@ -2225,11 +2110,6 @@
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-redirect": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz",
|
||||
"integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ="
|
||||
},
|
||||
"isarray": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||
@@ -2450,11 +2330,6 @@
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
||||
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
|
||||
},
|
||||
"pify": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pify/-/pify-5.0.0.tgz",
|
||||
"integrity": "sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA=="
|
||||
},
|
||||
"prism-media": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.2.tgz",
|
||||
@@ -2475,16 +2350,6 @@
|
||||
"ipaddr.js": "1.9.1"
|
||||
}
|
||||
},
|
||||
"psl": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
|
||||
"integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ=="
|
||||
},
|
||||
"punycode": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
|
||||
},
|
||||
"qs": {
|
||||
"version": "6.7.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
|
||||
@@ -2693,16 +2558,6 @@
|
||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
|
||||
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
|
||||
},
|
||||
"tough-cookie": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz",
|
||||
"integrity": "sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==",
|
||||
"requires": {
|
||||
"psl": "^1.1.33",
|
||||
"punycode": "^2.1.1",
|
||||
"universalify": "^0.1.2"
|
||||
}
|
||||
},
|
||||
"ts-mixer": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.0.tgz",
|
||||
@@ -2722,11 +2577,6 @@
|
||||
"mime-types": "~2.1.24"
|
||||
}
|
||||
},
|
||||
"universalify": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
|
||||
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="
|
||||
},
|
||||
"unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
@@ -2747,17 +2597,6 @@
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
|
||||
},
|
||||
"vrchat": {
|
||||
"version": "1.6.9",
|
||||
"resolved": "https://registry.npmjs.org/vrchat/-/vrchat-1.6.9.tgz",
|
||||
"integrity": "sha512-eV3EzHtObBGIzb5tEOP6vqeZsGIlMLXybO2CwpkSDvGra2ORIoh5hYnUq9JeMnAsmwF/xMpPHrb5yg5ZPDhAoA==",
|
||||
"requires": {
|
||||
"@types/tough-cookie": "^4.0.1",
|
||||
"axios": "^0.21.4",
|
||||
"axios-cookiejar-support": "^1.0.1",
|
||||
"tough-cookie": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"wide-align": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
|
||||
|
||||
+1
-3
@@ -3,13 +3,11 @@
|
||||
"@discordjs/voice": "^0.7.5",
|
||||
"deepl": "^1.0.12",
|
||||
"discord.js": "^13.6.0",
|
||||
"dotenv": "^16.0.0",
|
||||
"express": "^4.17.1",
|
||||
"fast-average-color-node": "^1.0.3",
|
||||
"kuroshiro": "^1.2.0",
|
||||
"kuroshiro-analyzer-kuromoji": "^1.1.0",
|
||||
"libsodium-wrappers": "^0.7.9",
|
||||
"node-fetch": "^2.6.1",
|
||||
"vrchat": "^1.6.9"
|
||||
"node-fetch": "^2.6.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
var vrchat = require("vrchat");
|
||||
var client = require("./client");
|
||||
var config = require("./config");
|
||||
var fs = require("fs");
|
||||
|
||||
var configuration = new vrchat.Configuration(config.vrchat_configuration);
|
||||
|
||||
var authenticationApi = new vrchat.AuthenticationApi(configuration);
|
||||
authenticationApi.getCurrentUser().then(console.log);
|
||||
|
||||
var usersApi = new vrchat.UsersApi(configuration);
|
||||
var worldsApi = new vrchat.WorldsApi(configuration);
|
||||
|
||||
var status2icon = {
|
||||
"join me": '🔵',
|
||||
"active": '🟢',
|
||||
"ask me": '🟠',
|
||||
"busy": '🔴',
|
||||
"offline": '⚫'
|
||||
}
|
||||
|
||||
try {
|
||||
var vrcul = JSON.parse(fs.readFileSync("data/vrcul.json"), "utf8");
|
||||
} catch(error) {
|
||||
var vrcul = [];
|
||||
}
|
||||
|
||||
async function updateUserStatuses() {
|
||||
for (let x of vrcul) {
|
||||
try {
|
||||
|
||||
let user = (await usersApi.getUser(x.userId)).data;
|
||||
let status_icon = user.state == "online" ? status2icon[user.status] : '⚫';
|
||||
let nn = `${status_icon} ${user.displayName}`;
|
||||
|
||||
var channel = client.channels.resolve(x.channel);
|
||||
if (!channel) {
|
||||
channel = await client.channels.resolve(config.vrchat_status_category).createChannel(nn, {type: "GUILD_VOICE"});
|
||||
x.channel = channel.id;
|
||||
fs.writeFileSync("data/vrcul.json", JSON.stringify(vrcul));
|
||||
} else if (nn != channel.name) {
|
||||
await channel.setName(nn);
|
||||
}
|
||||
|
||||
continue;
|
||||
|
||||
let belowChannel = client.channels.resolve(config.vrchat_status_category).children.find(x => x.position == channel.position + 1);
|
||||
if (user.worldId && user.worldId != "offline") {
|
||||
let bcn = `┗ ${await getWorldNameForId(user.worldId)}`;
|
||||
if (belowChannel && belowChannel.name.startsWith('┗') && belowChannel.name != bcn) { //todo debug
|
||||
await belowChannel.setName(bcn);
|
||||
} else {
|
||||
let ch = await client.channels.resolve(config.vrchat_status_category).createChannel(`┗ ${await getWorldNameForId(user.worldId)}`, {type: "GUILD_VOICE", /*position: belowChannel.position*/});
|
||||
// position option is erratic
|
||||
await ch.setPosition(channel.position + 1);
|
||||
}
|
||||
} else if (belowChannel?.name.startsWith('┗')) {
|
||||
await belowChannel.delete();
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error("vrcus", error.stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.interval = setInterval(updateUserStatuses, 1000*60*5);
|
||||
|
||||
|
||||
|
||||
|
||||
client.on("interactionCreate", async i => {
|
||||
if (i.commandName == "addvru") {
|
||||
try {
|
||||
await i.deferReply();
|
||||
let u = i.options.getString("user");
|
||||
let user = (await usersApi[u.startsWith("usr_") ? 'getUser' : 'getUserByName'](u)).data;
|
||||
let status_icon = user.state == "online" ? status2icon[user.status] : '⚫';
|
||||
let nn = `${status_icon} ${user.displayName}`;
|
||||
let channel = await client.channels.resolve(config.vrchat_status_category).createChannel(nn, {type: "GUILD_VOICE"});
|
||||
vrcul.push({channel: channel.id, userId: user.id});
|
||||
fs.writeFileSync("data/vrcul.json", JSON.stringify(vrcul));
|
||||
await i.editReply(channel.toString());
|
||||
} catch (error) {
|
||||
i.reply(error.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var worldnamecache = {};
|
||||
async function getWorldNameForId(worldId) {
|
||||
if (worldId == "private") return "Private World";
|
||||
return worldnamecache[worldId] = worldnamecache[worldId] || (await worldsApi.getWorld(worldId)).data.name;
|
||||
}
|
||||
Reference in New Issue
Block a user