Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d9a1b9b99c | |||
| 6fe26e7837 | |||
| afc2b10a86 | |||
| 3369bd521d | |||
| d52aff9936 | |||
| a44f81bddf | |||
| 2925c3d788 | |||
| 9dcd27c45f | |||
| e882ee7e57 | |||
| 20ecfb3e84 | |||
| 16f4b7eaf9 | |||
| 940d3f6c30 | |||
| 4252a2f060 | |||
| f602638aae | |||
| c9c45d17e7 | |||
| bf27b6519a | |||
| 085b51a95d | |||
| fc41f8ad2f | |||
| d6d05f6a72 | |||
| ed76ad6044 | |||
| c0036e7471 | |||
| 55812d6422 | |||
| 93b40700e0 | |||
| 345e368faa |
+1
-1
@@ -106,7 +106,7 @@ module.exports.deactivateMember = deactivateMember;
|
|||||||
module.exports.reactivateMember = reactivateMember;
|
module.exports.reactivateMember = reactivateMember;
|
||||||
|
|
||||||
|
|
||||||
client.on("messageCreate", message => {
|
client.on("messageCreate", async message => {
|
||||||
if (message.guildId != config.guild) return;
|
if (message.guildId != config.guild) return;
|
||||||
let deactivatedMembersMentionedViaRoles = [...new Set(message.mentions.roles.flatMap(r => r.members).values())].filter(x => ds.get(x.id + "deactivated"));
|
let deactivatedMembersMentionedViaRoles = [...new Set(message.mentions.roles.flatMap(r => r.members).values())].filter(x => ds.get(x.id + "deactivated"));
|
||||||
if (deactivatedMembersMentionedViaRoles.length) {
|
if (deactivatedMembersMentionedViaRoles.length) {
|
||||||
|
|||||||
@@ -8,82 +8,5 @@ var client = module.exports = new Discord.Client({
|
|||||||
|
|
||||||
client.login(config.token).then(async () => {
|
client.login(config.token).then(async () => {
|
||||||
console.log("ready");
|
console.log("ready");
|
||||||
(await client.channels.fetch(config.bot_channel))?.send('a');
|
(await client.channels.fetch(config.bot_channel))?.send('a2');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/* small misc stuff here */
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
client.on("guildMemberAdd", member => {
|
|
||||||
if (member.guild.id != config.guild) return;
|
|
||||||
// add role
|
|
||||||
member.roles.add(member.user.bot ? config.bot_role : config.human_role);
|
|
||||||
// welcome message
|
|
||||||
client.channels.resolve(config.default_channel)?.send(
|
|
||||||
`Welcome ${member}. Please tell from where you entered this server and some other info about yourself in order to gain access to message history.`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
// join message
|
|
||||||
/*client.on("messageDelete", message => {
|
|
||||||
if (message.channel.id != config.default_channel) return;
|
|
||||||
if (message.type != "GUILD_MEMBER_JOIN") return;
|
|
||||||
client.channels.resolve(config.default_channel)?.send(
|
|
||||||
`sussy baka ${message.author} deleted their join message ||(from <t:${Math.floor(message.createdAt.valueOf()/1000)}>)||`
|
|
||||||
);
|
|
||||||
});*/
|
|
||||||
client.on("guildMemberRemove", member => {
|
|
||||||
if (member.guild.id != config.guild) return;
|
|
||||||
// leave message
|
|
||||||
client.channels.resolve(config.default_channel)?.send(random([
|
|
||||||
`${member.user.username} left`,
|
|
||||||
`${member.user.username} disappeared`,
|
|
||||||
`${member.user.username.toLowerCase()} is gone`
|
|
||||||
]));
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
client.on("messageCreate", message => {
|
|
||||||
// comment thread on announcements
|
|
||||||
message.channel.id == config.announcement_channel && message.startThread({name: "Comments"});
|
|
||||||
// stupid m bot
|
|
||||||
message.author.id == "732072478519722096" && message.content.endsWith("is bad letter m is much better") && message.delete();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// add reactions to video and audio
|
|
||||||
{
|
|
||||||
let a = async m => {
|
|
||||||
if (m.guild?.id != config.guild) return;
|
|
||||||
if ((m.embeds.some(e => e.type == "video") || m.attachments.some(a => a.contentType?.startsWith('video'))) && !m.g) {
|
|
||||||
m.g = true;
|
|
||||||
m.react(config.mi_emoji);
|
|
||||||
}
|
|
||||||
if (m.attachments.some(a => a.contentType?.startsWith('audio')) && !m.d) {
|
|
||||||
m.d = true;
|
|
||||||
m.react(config.ki_emoji);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
client.on("messageCreate", a);
|
|
||||||
client.on("messageUpdate", (r, q) => a(q));
|
|
||||||
}
|
|
||||||
|
|
||||||
// thing to access archived channels
|
|
||||||
client.on("voiceStateUpdate", (oldState, newState) => {
|
|
||||||
if (newState.guild.id != config.guild) return;
|
|
||||||
if (oldState.channelId != config.archive_portal_voice_channel && newState.channelId == config.archive_portal_voice_channel) {
|
|
||||||
// join
|
|
||||||
newState.member?.roles.add(config.view_archived_channels_role);
|
|
||||||
} else if (oldState.channelId == config.archive_portal_voice_channel && newState.channelId != config.archive_portal_voice_channel) {
|
|
||||||
// leave
|
|
||||||
newState.member?.roles.remove(config.view_archived_channels_role);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// save deleted emojis
|
|
||||||
client.on("emojiDelete", emoji => {
|
|
||||||
client.channels.resolve(config.bot_channel)?.send({
|
|
||||||
content: "emoji deleted",
|
|
||||||
files: [{attachment: emoji.url, name: `${emoji.name}.${emoji.url.split('.').pop()}`}]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -72,5 +72,10 @@ module.exports = {
|
|||||||
tag: "巡音ルカ",
|
tag: "巡音ルカ",
|
||||||
channel: "916444961958928394"
|
channel: "916444961958928394"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
vrchat_status_category: "959236139913445376",
|
||||||
|
vrchat_configuration: {
|
||||||
|
username: process.env.VRCHAT_USERNAME,
|
||||||
|
password: process.env.VRCHAT_PASSWORD
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
var client = require("./client.js");
|
||||||
|
var config = require("./config");
|
||||||
|
|
||||||
|
|
||||||
|
client.on("guildMemberAdd", member => {
|
||||||
|
if (member.guild.id != config.guild) return;
|
||||||
|
// add role
|
||||||
|
member.roles.add(member.user.bot ? config.bot_role : config.human_role);
|
||||||
|
// welcome message
|
||||||
|
client.channels.resolve(config.default_channel)?.send(
|
||||||
|
`Welcome ${member}. Please tell from where you entered this server and some other info about yourself in order to gain access to message history.`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
// join message
|
||||||
|
/*client.on("messageDelete", message => {
|
||||||
|
if (message.channel.id != config.default_channel) return;
|
||||||
|
if (message.type != "GUILD_MEMBER_JOIN") return;
|
||||||
|
client.channels.resolve(config.default_channel)?.send(
|
||||||
|
`sussy baka ${message.author} deleted their join message ||(from <t:${Math.floor(message.createdAt.valueOf()/1000)}>)||`
|
||||||
|
);
|
||||||
|
});*/
|
||||||
|
client.on("guildMemberRemove", member => {
|
||||||
|
if (member.guild.id != config.guild) return;
|
||||||
|
// leave message
|
||||||
|
client.channels.resolve(config.default_channel)?.send(random([
|
||||||
|
`${member.user.username} left`,
|
||||||
|
`${member.user.username} disappeared`,
|
||||||
|
`${member.user.username.toLowerCase()} is gone`
|
||||||
|
]));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
client.on("messageCreate", message => {
|
||||||
|
// comment thread on announcements
|
||||||
|
message.channel.id == config.announcement_channel && message.startThread({name: "Comments"});
|
||||||
|
// stupid m bot
|
||||||
|
message.author.id == "732072478519722096" && message.content.endsWith("is bad letter m is much better") && message.delete();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// add reactions to video and audio
|
||||||
|
{
|
||||||
|
let a = async m => {
|
||||||
|
if (m.guild?.id != config.guild) return;
|
||||||
|
if ((m.embeds.some(e => e.type == "video") || m.attachments.some(a => a.contentType?.startsWith('video'))) && !m.g) {
|
||||||
|
m.g = true;
|
||||||
|
m.react(config.mi_emoji);
|
||||||
|
}
|
||||||
|
if (m.attachments.some(a => a.contentType?.startsWith('audio')) && !m.d) {
|
||||||
|
m.d = true;
|
||||||
|
m.react(config.ki_emoji);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
client.on("messageCreate", a);
|
||||||
|
client.on("messageUpdate", (r, q) => a(q));
|
||||||
|
}
|
||||||
|
|
||||||
|
// thing to access archived channels
|
||||||
|
client.on("voiceStateUpdate", (oldState, newState) => {
|
||||||
|
if (newState.guild.id != config.guild) return;
|
||||||
|
if (oldState.channelId != config.archive_portal_voice_channel && newState.channelId == config.archive_portal_voice_channel) {
|
||||||
|
// join
|
||||||
|
newState.member?.roles.add(config.view_archived_channels_role);
|
||||||
|
} else if (oldState.channelId == config.archive_portal_voice_channel && newState.channelId != config.archive_portal_voice_channel) {
|
||||||
|
// leave
|
||||||
|
newState.member?.roles.remove(config.view_archived_channels_role);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// save deleted emojis
|
||||||
|
client.on("emojiDelete", emoji => {
|
||||||
|
client.channels.resolve(config.bot_channel)?.send({
|
||||||
|
content: "emoji deleted",
|
||||||
|
files: [{attachment: emoji.url, name: `${emoji.name}.${emoji.url.split('.').pop()}`}]
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,19 +1,6 @@
|
|||||||
process.title = "lamp discord bot";
|
|
||||||
process.on("unhandledRejection", error => {
|
process.on("unhandledRejection", error => {
|
||||||
console.error("Unhandled Rejection:\n" + error.stack);
|
console.error("Unhandled Rejection:\n" + error.stack);
|
||||||
});
|
});
|
||||||
|
|
||||||
require("./util"); // global variables set in here
|
require("dotenv").config();
|
||||||
require("./client");
|
require("./vrchat");
|
||||||
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
+162
-1
@@ -8,12 +8,14 @@
|
|||||||
"@discordjs/voice": "^0.7.5",
|
"@discordjs/voice": "^0.7.5",
|
||||||
"deepl": "^1.0.12",
|
"deepl": "^1.0.12",
|
||||||
"discord.js": "^13.6.0",
|
"discord.js": "^13.6.0",
|
||||||
|
"dotenv": "^16.0.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"fast-average-color-node": "^1.0.3",
|
"fast-average-color-node": "^1.0.3",
|
||||||
"kuroshiro": "^1.2.0",
|
"kuroshiro": "^1.2.0",
|
||||||
"kuroshiro-analyzer-kuromoji": "^1.1.0",
|
"kuroshiro-analyzer-kuromoji": "^1.1.0",
|
||||||
"libsodium-wrappers": "^0.7.9",
|
"libsodium-wrappers": "^0.7.9",
|
||||||
"node-fetch": "^2.6.1"
|
"node-fetch": "^2.6.1",
|
||||||
|
"vrchat": "^1.6.9"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/runtime": {
|
"node_modules/@babel/runtime": {
|
||||||
@@ -143,6 +145,11 @@
|
|||||||
"node": ">= 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": {
|
"node_modules/@types/ws": {
|
||||||
"version": "8.2.2",
|
"version": "8.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.2.tgz",
|
||||||
@@ -227,6 +234,23 @@
|
|||||||
"follow-redirects": "^1.14.0"
|
"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": {
|
"node_modules/balanced-match": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||||
@@ -471,6 +495,14 @@
|
|||||||
"npm": ">=7.0.0"
|
"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": {
|
"node_modules/doublearray": {
|
||||||
"version": "0.0.2",
|
"version": "0.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/doublearray/-/doublearray-0.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/doublearray/-/doublearray-0.0.2.tgz",
|
||||||
@@ -784,6 +816,14 @@
|
|||||||
"node": ">=0.10.0"
|
"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": {
|
"node_modules/isarray": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||||
@@ -1083,6 +1123,17 @@
|
|||||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
||||||
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
|
"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": {
|
"node_modules/prism-media": {
|
||||||
"version": "1.3.2",
|
"version": "1.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.2.tgz",
|
||||||
@@ -1125,6 +1176,19 @@
|
|||||||
"node": ">= 0.10"
|
"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": {
|
"node_modules/qs": {
|
||||||
"version": "6.7.0",
|
"version": "6.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
|
||||||
@@ -1389,6 +1453,19 @@
|
|||||||
"node": ">=0.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": {
|
"node_modules/ts-mixer": {
|
||||||
"version": "6.0.0",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.0.tgz",
|
||||||
@@ -1411,6 +1488,14 @@
|
|||||||
"node": ">= 0.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": {
|
"node_modules/unpipe": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||||
@@ -1440,6 +1525,17 @@
|
|||||||
"node": ">= 0.8"
|
"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": {
|
"node_modules/wide-align": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
|
||||||
@@ -1593,6 +1689,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@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": {
|
"@types/ws": {
|
||||||
"version": "8.2.2",
|
"version": "8.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.2.tgz",
|
||||||
@@ -1668,6 +1769,15 @@
|
|||||||
"follow-redirects": "^1.14.0"
|
"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": {
|
"balanced-match": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||||
@@ -1856,6 +1966,11 @@
|
|||||||
"ws": "^8.4.0"
|
"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": {
|
"doublearray": {
|
||||||
"version": "0.0.2",
|
"version": "0.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/doublearray/-/doublearray-0.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/doublearray/-/doublearray-0.0.2.tgz",
|
||||||
@@ -2110,6 +2225,11 @@
|
|||||||
"number-is-nan": "^1.0.0"
|
"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": {
|
"isarray": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||||
@@ -2330,6 +2450,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
||||||
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
|
"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": {
|
"prism-media": {
|
||||||
"version": "1.3.2",
|
"version": "1.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.2.tgz",
|
||||||
@@ -2350,6 +2475,16 @@
|
|||||||
"ipaddr.js": "1.9.1"
|
"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": {
|
"qs": {
|
||||||
"version": "6.7.0",
|
"version": "6.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
|
||||||
@@ -2558,6 +2693,16 @@
|
|||||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
|
||||||
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
|
"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": {
|
"ts-mixer": {
|
||||||
"version": "6.0.0",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.0.tgz",
|
||||||
@@ -2577,6 +2722,11 @@
|
|||||||
"mime-types": "~2.1.24"
|
"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": {
|
"unpipe": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||||
@@ -2597,6 +2747,17 @@
|
|||||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||||
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
|
"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": {
|
"wide-align": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
|
||||||
|
|||||||
+3
-1
@@ -3,11 +3,13 @@
|
|||||||
"@discordjs/voice": "^0.7.5",
|
"@discordjs/voice": "^0.7.5",
|
||||||
"deepl": "^1.0.12",
|
"deepl": "^1.0.12",
|
||||||
"discord.js": "^13.6.0",
|
"discord.js": "^13.6.0",
|
||||||
|
"dotenv": "^16.0.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"fast-average-color-node": "^1.0.3",
|
"fast-average-color-node": "^1.0.3",
|
||||||
"kuroshiro": "^1.2.0",
|
"kuroshiro": "^1.2.0",
|
||||||
"kuroshiro-analyzer-kuromoji": "^1.1.0",
|
"kuroshiro-analyzer-kuromoji": "^1.1.0",
|
||||||
"libsodium-wrappers": "^0.7.9",
|
"libsodium-wrappers": "^0.7.9",
|
||||||
"node-fetch": "^2.6.1"
|
"node-fetch": "^2.6.1",
|
||||||
|
"vrchat": "^1.6.9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
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