Compare commits
No commits in common. "bb6662554173276d123448d008a2215285b2870a" and "b02ac22ab7aee65f7bf4f4a7e527dff4edefd779" have entirely different histories.
bb66625541
...
b02ac22ab7
46
backup.js
46
backup.js
@ -1,46 +0,0 @@
|
||||
|
||||
class DiscordBackup {
|
||||
constructor(guild) {
|
||||
this.guild = guild;
|
||||
this.data = {};
|
||||
}
|
||||
|
||||
async backupGuild() {
|
||||
// includes emojis, stickers, roles
|
||||
this.data.guild = await this.guild.client.api.guilds(this.guild.id).get();
|
||||
}
|
||||
|
||||
async backupMembers() {
|
||||
this.data.members = await this.guild.client.api.guilds(this.guild.id).members.get({query: {limit: 1000}});
|
||||
}
|
||||
|
||||
async backupChannel(channel) {
|
||||
var data = {
|
||||
channel: await client.api.channels[channel.id].get(),
|
||||
messages: []
|
||||
};
|
||||
do {
|
||||
var messages = await client.api.channels[channel.id].messages.get({ query: {options: {
|
||||
before: messages?.[0].id, limit: 100
|
||||
}}});
|
||||
data.messages.unshift(...messages);
|
||||
} while (messages.length > 0);
|
||||
this.data.channels ||= [];
|
||||
this.data.channels.push(data);
|
||||
}
|
||||
|
||||
async backupEverything() {
|
||||
await this.backupGuild();
|
||||
await this.backupMembers();
|
||||
for (let [id, channel] of this.guild.channels) {
|
||||
await this.backupChannel(channel);
|
||||
}
|
||||
}
|
||||
|
||||
async serialize() {
|
||||
return JSON.stringify(this.data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports.DiscordBackup = DiscordBackup;
|
@ -9,11 +9,11 @@ var commands = require("./commands");
|
||||
|
||||
|
||||
function getColorRoleFor(user_id) {
|
||||
var color_id;
|
||||
try {
|
||||
return client.guilds.resolve(config.guild)?.roles.fetch(
|
||||
fs.readFileSync(config.data_dir + "color/" + user_id, "utf8")
|
||||
);
|
||||
color_id = fs.readFileSync(config.data_dir + "color/" + user_id, "utf8");
|
||||
} catch (e) {}
|
||||
return client.guilds.resolve(config.guild)?.roles.fetch(color_id);
|
||||
}
|
||||
module.exports.getColorRoleFor = getColorRoleFor;
|
||||
|
||||
|
158
package-lock.json
generated
158
package-lock.json
generated
@ -5,14 +5,12 @@
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"@discordjs/voice": "^0.7.5",
|
||||
"deepl": "^1.0.12",
|
||||
"discord.js": "github:iShibi/discord.js#feat-role-icon",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
@ -64,59 +62,6 @@
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/voice": {
|
||||
"version": "0.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.7.5.tgz",
|
||||
"integrity": "sha512-lUk+CmIXNKslT6DkC9IF9rpsqhzlTiedauUCPBzepjd4XWxwBZiyVIzR6QpbAirxkAwCoAbbje+3Ho71PGLEAw==",
|
||||
"dependencies": {
|
||||
"@types/ws": "^8.2.0",
|
||||
"discord-api-types": "^0.24.0",
|
||||
"prism-media": "^1.3.2",
|
||||
"tiny-typed-emitter": "^2.1.0",
|
||||
"tslib": "^2.3.1",
|
||||
"ws": "^8.2.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/voice/node_modules/@types/ws": {
|
||||
"version": "8.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.2.tgz",
|
||||
"integrity": "sha512-NOn5eIcgWLOo6qW8AcuLZ7G8PycXu0xTxxkS6Q18VWFxgPUSOwV0pBj2a/4viNZVu25i7RIB7GttdkAIUUXOOg==",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/voice/node_modules/discord-api-types": {
|
||||
"version": "0.24.0",
|
||||
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.24.0.tgz",
|
||||
"integrity": "sha512-X0uA2a92cRjowUEXpLZIHWl4jiX1NsUpDhcEOpa1/hpO1vkaokgZ8kkPtPih9hHth5UVQ3mHBu/PpB4qjyfJ4A==",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/voice/node_modules/ws": {
|
||||
"version": "8.4.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.4.0.tgz",
|
||||
"integrity": "sha512-IHVsKe2pjajSUIl4KYMQOdlyliovpEPquKkqbwswulszzI7r0SfQrxnXdWAEqOlDCLrVSJzo+O1hAwdog2sKSQ==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": "^5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@mapbox/node-pre-gyp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.5.tgz",
|
||||
@ -852,19 +797,6 @@
|
||||
"kuromoji": "^0.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/libsodium": {
|
||||
"version": "0.7.9",
|
||||
"resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.9.tgz",
|
||||
"integrity": "sha512-gfeADtR4D/CM0oRUviKBViMGXZDgnFdMKMzHsvBdqLBHd9ySi6EtYnmuhHVDDYgYpAO8eU8hEY+F8vIUAPh08A=="
|
||||
},
|
||||
"node_modules/libsodium-wrappers": {
|
||||
"version": "0.7.9",
|
||||
"resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz",
|
||||
"integrity": "sha512-9HaAeBGk1nKTRFRHkt7nzxqCvnkWTjn1pdjKgcUnZxj0FyOP4CnhgFhMdrFfgNsukijBGyBLpP2m2uKT1vuWhQ==",
|
||||
"dependencies": {
|
||||
"libsodium": "^0.7.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
@ -1141,31 +1073,6 @@
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
||||
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
|
||||
},
|
||||
"node_modules/prism-media": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.2.tgz",
|
||||
"integrity": "sha512-L6UsGHcT6i4wrQhFF1aPK+MNYgjRqR2tUoIqEY+CG1NqVkMjPRKzS37j9f8GiYPlD6wG9ruBj+q5Ax+bH8Ik1g==",
|
||||
"peerDependencies": {
|
||||
"@discordjs/opus": "^0.5.0",
|
||||
"ffmpeg-static": "^4.2.7 || ^3.0.0 || ^2.4.0",
|
||||
"node-opus": "^0.3.3",
|
||||
"opusscript": "^0.0.8"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@discordjs/opus": {
|
||||
"optional": true
|
||||
},
|
||||
"ffmpeg-static": {
|
||||
"optional": true
|
||||
},
|
||||
"node-opus": {
|
||||
"optional": true
|
||||
},
|
||||
"opusscript": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/process-nextick-args": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||
@ -1434,11 +1341,6 @@
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/tiny-typed-emitter": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/tiny-typed-emitter/-/tiny-typed-emitter-2.1.0.tgz",
|
||||
"integrity": "sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA=="
|
||||
},
|
||||
"node_modules/toidentifier": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
|
||||
@ -1600,40 +1502,6 @@
|
||||
"mime-types": "^2.1.12"
|
||||
}
|
||||
},
|
||||
"@discordjs/voice": {
|
||||
"version": "0.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.7.5.tgz",
|
||||
"integrity": "sha512-lUk+CmIXNKslT6DkC9IF9rpsqhzlTiedauUCPBzepjd4XWxwBZiyVIzR6QpbAirxkAwCoAbbje+3Ho71PGLEAw==",
|
||||
"requires": {
|
||||
"@types/ws": "^8.2.0",
|
||||
"discord-api-types": "^0.24.0",
|
||||
"prism-media": "^1.3.2",
|
||||
"tiny-typed-emitter": "^2.1.0",
|
||||
"tslib": "^2.3.1",
|
||||
"ws": "^8.2.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/ws": {
|
||||
"version": "8.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.2.tgz",
|
||||
"integrity": "sha512-NOn5eIcgWLOo6qW8AcuLZ7G8PycXu0xTxxkS6Q18VWFxgPUSOwV0pBj2a/4viNZVu25i7RIB7GttdkAIUUXOOg==",
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"discord-api-types": {
|
||||
"version": "0.24.0",
|
||||
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.24.0.tgz",
|
||||
"integrity": "sha512-X0uA2a92cRjowUEXpLZIHWl4jiX1NsUpDhcEOpa1/hpO1vkaokgZ8kkPtPih9hHth5UVQ3mHBu/PpB4qjyfJ4A=="
|
||||
},
|
||||
"ws": {
|
||||
"version": "8.4.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.4.0.tgz",
|
||||
"integrity": "sha512-IHVsKe2pjajSUIl4KYMQOdlyliovpEPquKkqbwswulszzI7r0SfQrxnXdWAEqOlDCLrVSJzo+O1hAwdog2sKSQ==",
|
||||
"requires": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@mapbox/node-pre-gyp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.5.tgz",
|
||||
@ -1919,7 +1787,7 @@
|
||||
},
|
||||
"discord.js": {
|
||||
"version": "git+ssh://git@github.com/iShibi/discord.js.git#3782416c07a1e8f207657db1fc8fc973488b7c86",
|
||||
"from": "discord.js@github:iShibi/discord.js#feat-role-icon",
|
||||
"from": "discord.js@git://github.com/iShibi/discord.js#feat-role-icon",
|
||||
"requires": {
|
||||
"@discordjs/builders": "^0.5.0",
|
||||
"@discordjs/collection": "^0.2.1",
|
||||
@ -2219,19 +2087,6 @@
|
||||
"kuromoji": "^0.1.1"
|
||||
}
|
||||
},
|
||||
"libsodium": {
|
||||
"version": "0.7.9",
|
||||
"resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.9.tgz",
|
||||
"integrity": "sha512-gfeADtR4D/CM0oRUviKBViMGXZDgnFdMKMzHsvBdqLBHd9ySi6EtYnmuhHVDDYgYpAO8eU8hEY+F8vIUAPh08A=="
|
||||
},
|
||||
"libsodium-wrappers": {
|
||||
"version": "0.7.9",
|
||||
"resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz",
|
||||
"integrity": "sha512-9HaAeBGk1nKTRFRHkt7nzxqCvnkWTjn1pdjKgcUnZxj0FyOP4CnhgFhMdrFfgNsukijBGyBLpP2m2uKT1vuWhQ==",
|
||||
"requires": {
|
||||
"libsodium": "^0.7.0"
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
@ -2426,12 +2281,6 @@
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
||||
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
|
||||
},
|
||||
"prism-media": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.2.tgz",
|
||||
"integrity": "sha512-L6UsGHcT6i4wrQhFF1aPK+MNYgjRqR2tUoIqEY+CG1NqVkMjPRKzS37j9f8GiYPlD6wG9ruBj+q5Ax+bH8Ik1g==",
|
||||
"requires": {}
|
||||
},
|
||||
"process-nextick-args": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||
@ -2644,11 +2493,6 @@
|
||||
"yallist": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"tiny-typed-emitter": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/tiny-typed-emitter/-/tiny-typed-emitter-2.1.0.tgz",
|
||||
"integrity": "sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA=="
|
||||
},
|
||||
"toidentifier": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
|
||||
|
@ -1,13 +1,11 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@discordjs/voice": "^0.7.5",
|
||||
"deepl": "^1.0.12",
|
||||
"discord.js": "github:iShibi/discord.js#feat-role-icon",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user