mirror of
https://github.com/litruv/DAdmin.git
synced 2026-07-24 10:46:14 +10:00
Merge branch 'master' of https://github.com/litruv/DAdmin
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -6,3 +6,5 @@ googleapi\.json
|
|||||||
setup.json
|
setup.json
|
||||||
merged.mp3
|
merged.mp3
|
||||||
output.mp3
|
output.mp3
|
||||||
|
privkey.pem
|
||||||
|
cert.pem
|
||||||
|
|||||||
25
package-lock.json
generated
25
package-lock.json
generated
@@ -401,6 +401,17 @@
|
|||||||
"snekfetch": "^3.6.4",
|
"snekfetch": "^3.6.4",
|
||||||
"tweetnacl": "^1.0.0",
|
"tweetnacl": "^1.0.0",
|
||||||
"ws": "^4.0.0"
|
"ws": "^4.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"ws": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ws/-/ws-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-ZGh/8kF9rrRNffkLFV4AzhvooEclrOH0xaugmqGsIfFgOE/pIz4fMc4Ef+5HSQqTEug2S9JZIWDR47duDSLfaA==",
|
||||||
|
"requires": {
|
||||||
|
"async-limiter": "~1.0.0",
|
||||||
|
"safe-buffer": "~5.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"duplexify": {
|
"duplexify": {
|
||||||
@@ -505,6 +516,11 @@
|
|||||||
"escape-string-regexp": "^1.0.5"
|
"escape-string-regexp": "^1.0.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flatted": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg=="
|
||||||
|
},
|
||||||
"fluent-ffmpeg": {
|
"fluent-ffmpeg": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/fluent-ffmpeg/-/fluent-ffmpeg-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/fluent-ffmpeg/-/fluent-ffmpeg-2.1.2.tgz",
|
||||||
@@ -1831,12 +1847,11 @@
|
|||||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||||
},
|
},
|
||||||
"ws": {
|
"ws": {
|
||||||
"version": "4.1.0",
|
"version": "6.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
|
||||||
"integrity": "sha512-ZGh/8kF9rrRNffkLFV4AzhvooEclrOH0xaugmqGsIfFgOE/pIz4fMc4Ef+5HSQqTEug2S9JZIWDR47duDSLfaA==",
|
"integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"async-limiter": "~1.0.0",
|
"async-limiter": "~1.0.0"
|
||||||
"safe-buffer": "~5.1.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"xtend": {
|
"xtend": {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
"@google-cloud/vision": "^0.25.0",
|
"@google-cloud/vision": "^0.25.0",
|
||||||
"colors": "^1.3.3",
|
"colors": "^1.3.3",
|
||||||
"discord.js": "^11.4.2",
|
"discord.js": "^11.4.2",
|
||||||
|
"flatted": "^2.0.0",
|
||||||
"fluent-ffmpeg": "^2.1.2",
|
"fluent-ffmpeg": "^2.1.2",
|
||||||
"inquirer": "^6.2.2",
|
"inquirer": "^6.2.2",
|
||||||
"mysql": "^2.16.0",
|
"mysql": "^2.16.0",
|
||||||
@@ -15,7 +16,8 @@
|
|||||||
"ping": "^0.2.2",
|
"ping": "^0.2.2",
|
||||||
"promise-mysql": "^3.3.1",
|
"promise-mysql": "^3.3.1",
|
||||||
"readline": "^1.3.0",
|
"readline": "^1.3.0",
|
||||||
"request": "^2.88.0"
|
"request": "^2.88.0",
|
||||||
|
"ws": "^6.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
"devDependencies": {},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -21,9 +21,7 @@ module.exports = {
|
|||||||
.then(chan => {
|
.then(chan => {
|
||||||
chan.setParent(autoparent)
|
chan.setParent(autoparent)
|
||||||
chan.setTopic(cid)
|
chan.setTopic(cid)
|
||||||
chan.send(newMember + " **Hey**, this is the Text channel for your voice chat.\r\n **IT WILL BE DELETED ONCE EVERYONE LEAVES**")
|
chan.send(newMember + " **Hey**, this is the Text channel for your voice chat.\r\n **IT WILL BE DELETED ONCE EVERYONE LEAVES**\nIf you would like to **share screens** or use your **webcam**: **<http://www.discordapp.com/channels/" + chan.guild.id + "/" + cid + "/>**\n*⁽ᵗʰᶦˢ ᶠᵉᵃᵗᵘʳᵉ ᶦˢ ᵒⁿˡʸ ᵃᵛᵃᶦˡᵃᵇˡᵉ ᶦᶠ ʸᵒᵘ'ʳᵉ ᶦⁿ ᵗʰᵉ ᶜʰᵃᵗ⁾*")
|
||||||
chan.send("If you would like to **share screens** or use your **webcam**: **<http://www.discordapp.com/channels/" + chan.guild.id + "/" + cid + "/>**")
|
|
||||||
chan.send("*⁽ᵗʰᶦˢ ᶠᵉᵃᵗᵘʳᵉ ᶦˢ ᵒⁿˡʸ ᵃᵛᵃᶦˡᵃᵇˡᵉ ᶦᶠ ʸᵒᵘ'ʳᵉ ᶦⁿ ᵗʰᵉ ᶜʰᵃᵗ⁾*")
|
|
||||||
//chan.send("https://gfycat.com/RadiantFoolishAmmonite")
|
//chan.send("https://gfycat.com/RadiantFoolishAmmonite")
|
||||||
|
|
||||||
console.log("Made a Auto Channel Set: " + newMember.presence.game.name + " - " + newMember.displayName)
|
console.log("Made a Auto Channel Set: " + newMember.presence.game.name + " - " + newMember.displayName)
|
||||||
@@ -45,9 +43,7 @@ module.exports = {
|
|||||||
.then(chan => {
|
.then(chan => {
|
||||||
chan.setParent(autoparent)
|
chan.setParent(autoparent)
|
||||||
chan.setTopic(cid)
|
chan.setTopic(cid)
|
||||||
chan.send(newMember + " **Hey**, this is the Text channel for your voice chat.\r\n **IT WILL BE DELETED ONCE EVERYONE LEAVES**")
|
chan.send(newMember + " **Hey**, this is the Text channel for your voice chat.\r\n **IT WILL BE DELETED ONCE EVERYONE LEAVES**\nIf you would like to **share screens** or use your **webcam**: **<http://www.discordapp.com/channels/" + chan.guild.id + "/" + cid + "/>**\n*⁽ᵗʰᶦˢ ᶠᵉᵃᵗᵘʳᵉ ᶦˢ ᵒⁿˡʸ ᵃᵛᵃᶦˡᵃᵇˡᵉ ᶦᶠ ʸᵒᵘ'ʳᵉ ᶦⁿ ᵗʰᵉ ᶜʰᵃᵗ⁾*")
|
||||||
chan.send("\\***NEW**\\* If you would like to **share screens** or use your **webcam**: **<http://www.discordapp.com/channels/" + chan.guild.id + "/" + cid + "/>**")
|
|
||||||
chan.send("*⁽ᵗʰᶦˢ ᶠᵉᵃᵗᵘʳᵉ ᶦˢ ᵒⁿˡʸ ᵃᵛᵃᶦˡᵃᵇˡᵉ ᶦᶠ ʸᵒᵘ'ʳᵉ ᶦⁿ ᵗʰᵉ ᶜʰᵃᵗ⁾*")
|
|
||||||
// chan.send("https://gfycat.com/RadiantFoolishAmmonite")
|
// chan.send("https://gfycat.com/RadiantFoolishAmmonite")
|
||||||
console.log("Made a Auto Channel Set: General - " + newMember.displayName)
|
console.log("Made a Auto Channel Set: General - " + newMember.displayName)
|
||||||
|
|
||||||
|
|||||||
64
plugins/wss.js
Normal file
64
plugins/wss.js
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const https = require('https');
|
||||||
|
const WebSocket = require('ws');
|
||||||
|
const { parse, stringify } = require('flatted/cjs');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "Websockets Server (8080)",
|
||||||
|
init: (dclient) => {
|
||||||
|
const server = https.createServer({
|
||||||
|
cert: fs.readFileSync('./cert.pem'),
|
||||||
|
key: fs.readFileSync('./privkey.pem')
|
||||||
|
});
|
||||||
|
const wss = new WebSocket.Server({ server });
|
||||||
|
|
||||||
|
wss.on('connection', function connection(ws) {
|
||||||
|
ws.on('message', function incoming(message) {
|
||||||
|
console.log('received: %s', message);
|
||||||
|
|
||||||
|
try {
|
||||||
|
var data = parse(message)
|
||||||
|
|
||||||
|
var response = {
|
||||||
|
type: "data",
|
||||||
|
data: new Array()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.type == "request") {
|
||||||
|
for (var i = 0; i < data.requests.length; i++) {
|
||||||
|
var resp = ""
|
||||||
|
if (data.requests[i] == "name")
|
||||||
|
resp = dclient.user.username
|
||||||
|
if (data.requests[i] == "id")
|
||||||
|
resp = dclient.user.id
|
||||||
|
if (data.requests[i] == "discriminator")
|
||||||
|
resp = dclient.user.discriminator
|
||||||
|
if (data.requests[i] == "avatar")
|
||||||
|
resp = dclient.user.avatarURL
|
||||||
|
response.data.push({ type: data.requests[i], data: resp })
|
||||||
|
}
|
||||||
|
|
||||||
|
ws.send(JSON.stringify(response))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
ws.send('Connected');
|
||||||
|
});
|
||||||
|
|
||||||
|
setInterval(() => { //heartbeat
|
||||||
|
wss.clients.forEach(client => {
|
||||||
|
if (client.readyState == client.OPEN) {
|
||||||
|
client.send(JSON.stringify({ type: "heartbeat", time: new Date().getTime() }))
|
||||||
|
client.ping()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 30000);
|
||||||
|
|
||||||
|
server.listen(8080);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user