chatsounds command cause why not
This commit is contained in:
parent
4045f25ae7
commit
c8b3bfd183
4 changed files with 62 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,5 +1,6 @@
|
|||
node_modules/
|
||||
priv/
|
||||
cache/
|
||||
|
||||
config.json
|
||||
config.prod.json
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
"jimp": "^0.22.7",
|
||||
"murmurhash": "^2.0.1",
|
||||
"node-ffprobe": "^3.0.0",
|
||||
"sh": "github:LitterbinCollective/sh",
|
||||
"sharp": "^0.32.0",
|
||||
"spitroast": "^1.4.3",
|
||||
"sqlite3": "^5.1.6"
|
||||
|
|
17
pnpm-lock.yaml
generated
17
pnpm-lock.yaml
generated
|
@ -32,6 +32,9 @@ importers:
|
|||
node-ffprobe:
|
||||
specifier: ^3.0.0
|
||||
version: 3.0.0
|
||||
sh:
|
||||
specifier: github:LitterbinCollective/sh
|
||||
version: git+https://git@github.com:LitterbinCollective/sh.git#e89cbcbfffd251c5bd0fb9caa00d86754afba8f6
|
||||
sharp:
|
||||
specifier: ^0.32.0
|
||||
version: 0.32.0
|
||||
|
@ -428,6 +431,10 @@ packages:
|
|||
resolution: {integrity: sha512-4ySo4CjzStuprMwk35H5pPbkymjv1SF3jGLj6rAHp/xT/RF7TL7bd9CTm1xDY49K2qF7jmR/g7k+SkLETP6opA==}
|
||||
hasBin: true
|
||||
|
||||
'@msgpack/msgpack@2.8.0':
|
||||
resolution: {integrity: sha512-h9u4u/jiIRKbq25PM+zymTyW6bhTzELvOoUd+AvYriWOAKpLGnIamaET3pnHYoI5iYphAHBI4ayx0MehR+VVPQ==}
|
||||
engines: {node: '>= 10'}
|
||||
|
||||
'@nodelib/fs.scandir@2.1.5':
|
||||
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
|
||||
engines: {node: '>= 8'}
|
||||
|
@ -1364,6 +1371,10 @@ packages:
|
|||
set-blocking@2.0.0:
|
||||
resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==}
|
||||
|
||||
sh@git+https://git@github.com:LitterbinCollective/sh.git#e89cbcbfffd251c5bd0fb9caa00d86754afba8f6:
|
||||
resolution: {commit: e89cbcbfffd251c5bd0fb9caa00d86754afba8f6, repo: git@github.com:LitterbinCollective/sh.git, type: git}
|
||||
version: 1.0.0
|
||||
|
||||
sharp@0.32.0:
|
||||
resolution: {integrity: sha512-yLAypVcqj1toSAqRSwbs86nEzfyZVDYqjuUX8grhFpeij0DDNagKJXELS/auegDBRDg1XBtELdOGfo2X1cCpeA==}
|
||||
engines: {node: '>=14.15.0'}
|
||||
|
@ -2093,6 +2104,8 @@ snapshots:
|
|||
- encoding
|
||||
- supports-color
|
||||
|
||||
'@msgpack/msgpack@2.8.0': {}
|
||||
|
||||
'@nodelib/fs.scandir@2.1.5':
|
||||
dependencies:
|
||||
'@nodelib/fs.stat': 2.0.5
|
||||
|
@ -3129,6 +3142,10 @@ snapshots:
|
|||
|
||||
set-blocking@2.0.0: {}
|
||||
|
||||
sh@git+https://git@github.com:LitterbinCollective/sh.git#e89cbcbfffd251c5bd0fb9caa00d86754afba8f6:
|
||||
dependencies:
|
||||
'@msgpack/msgpack': 2.8.0
|
||||
|
||||
sharp@0.32.0:
|
||||
dependencies:
|
||||
color: 4.2.3
|
||||
|
|
43
src/modules/misc/chatsounds.js
Normal file
43
src/modules/misc/chatsounds.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
const Command = require("#lib/command.js");
|
||||
const {default: Chatsounds, defaultModifiers} = require("sh");
|
||||
|
||||
const sh = new Chatsounds();
|
||||
(async () => {
|
||||
sh.useModifiers(defaultModifiers);
|
||||
|
||||
await sh.useSourcesFromGitHubMsgPack("PAC3-Server/chatsounds-valve-games", "master", "csgo");
|
||||
await sh.useSourcesFromGitHubMsgPack("PAC3-Server/chatsounds-valve-games", "master", "css");
|
||||
await sh.useSourcesFromGitHubMsgPack("PAC3-Server/chatsounds-valve-games", "master", "ep1");
|
||||
await sh.useSourcesFromGitHubMsgPack("PAC3-Server/chatsounds-valve-games", "master", "ep2");
|
||||
await sh.useSourcesFromGitHubMsgPack("PAC3-Server/chatsounds-valve-games", "master", "hl1");
|
||||
await sh.useSourcesFromGitHubMsgPack("PAC3-Server/chatsounds-valve-games", "master", "hl2");
|
||||
await sh.useSourcesFromGitHubMsgPack("PAC3-Server/chatsounds-valve-games", "master", "l4d");
|
||||
await sh.useSourcesFromGitHubMsgPack("PAC3-Server/chatsounds-valve-games", "master", "l4d2");
|
||||
await sh.useSourcesFromGitHubMsgPack("PAC3-Server/chatsounds-valve-games", "master", "portal");
|
||||
await sh.useSourcesFromGitHubMsgPack("PAC3-Server/chatsounds-valve-games", "master", "tf2");
|
||||
await sh.useSourcesFromGitHub("PAC3-Server/chatsounds", "master", "sounds/chatsounds");
|
||||
await sh.useSourcesFromGitHub("Metastruct/garrysmod-chatsounds", "master", "sound/chatsounds/autoadd");
|
||||
sh.mergeSources();
|
||||
})();
|
||||
|
||||
const chatsounds = new Command("chatsounds");
|
||||
chatsounds.category = "misc";
|
||||
chatsounds.helpText = "Garry's Mod chatsounds as a file output";
|
||||
chatsounds.callback = async function (msg, line) {
|
||||
const context = sh.new(line);
|
||||
// bitrate will be wrong, ios users cope
|
||||
const audio = await context.buffer({sampleRate: 48000, audioChannels: 1, format: "ogg", codec: "libopus"});
|
||||
|
||||
return {
|
||||
flags: 1 << 13,
|
||||
attachments: [
|
||||
{
|
||||
file: audio,
|
||||
filename: "voice-message.ogg",
|
||||
// FIXME: lazy
|
||||
duration_secs: 1,
|
||||
waveform: "",
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue