mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-19 01:01:39 +01:00
add factorio destruction sound alert, add command and cheer parser tests
This commit is contained in:
46
src/__tests__/argsparse.test.ts
Normal file
46
src/__tests__/argsparse.test.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import parseCommandArgs, { parseCheerArgs } from "lib/parseCommandArgs";
|
||||
|
||||
describe("command argument parser", () => {
|
||||
test("split command into chunks", () => {
|
||||
expect(parseCommandArgs("!execute eponirewq")).toEqual(["eponirewq"]);
|
||||
expect(parseCommandArgs("!getloot")).toEqual([]);
|
||||
expect(parseCommandArgs("!inv qwerinope")).toEqual(["qwerinope"]);
|
||||
expect(parseCommandArgs("!admingive qwerinope silverbullet 67")).toEqual([
|
||||
"qwerinope",
|
||||
"silverbullet",
|
||||
"67",
|
||||
]);
|
||||
});
|
||||
|
||||
test("handle the !use command", () => {
|
||||
expect(parseCommandArgs("!use silverbullet albeees")).toEqual(["albeees"]);
|
||||
expect(parseCommandArgs("!use grenade")).toEqual([]);
|
||||
});
|
||||
|
||||
test("handle special aliases", () => {
|
||||
expect(parseCommandArgs("i blast mrockstar20", "i")).toEqual([
|
||||
"mrockstar20",
|
||||
]);
|
||||
expect(parseCommandArgs("blastin sefi", "blastin")).toEqual(["sefi"]);
|
||||
expect(parseCommandArgs("i grenade", "i")).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("cheer argument parser", () => {
|
||||
test("basic parsing", () => {
|
||||
expect(parseCheerArgs("cheer99")).toEqual([]);
|
||||
expect(parseCheerArgs("grenade out! cheer99")).toEqual(["grenade", "out!"]);
|
||||
expect(parseCheerArgs("cheer666 albeees")).toEqual(["albeees"]);
|
||||
expect(parseCheerArgs("albeees cheer666")).toEqual(["albeees"]);
|
||||
});
|
||||
|
||||
test("Remove all cheers", () => {
|
||||
expect(parseCheerArgs("cheer1 cheer1 cheer1")).toEqual([]);
|
||||
expect(parseCheerArgs("TAKE CHEER1 THIS chEEr1 SPAM CheeR6969")).toEqual([
|
||||
"take",
|
||||
"this",
|
||||
"spam",
|
||||
]);
|
||||
});
|
||||
});
|
||||
17
src/pointRedeems/sfxFactorioAlert.ts
Normal file
17
src/pointRedeems/sfxFactorioAlert.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import PointRedeem from "pointRedeems";
|
||||
import { playAlert } from "web/alerts/serverFunctions";
|
||||
|
||||
export default new PointRedeem({
|
||||
name: "sfxFactorioAlert",
|
||||
title: "Factorio Building Destroyed",
|
||||
cost: 100,
|
||||
color: "#A020F0",
|
||||
prompt: 'Play the Factorio "Building Destroyed" sound effect',
|
||||
sfxredeem: true,
|
||||
execution: async (msg) =>
|
||||
await playAlert({
|
||||
name: "sound",
|
||||
user: msg.userDisplayName,
|
||||
sound: "factorioalert",
|
||||
}),
|
||||
});
|
||||
@@ -21,7 +21,11 @@ export type tntExplosionAlert = alertBase<"tntExplosion"> & {
|
||||
targets: string[];
|
||||
};
|
||||
|
||||
export type soundAlerts = "mrockmadhouse" | "eddiescream" | "ripbozo";
|
||||
export type soundAlerts =
|
||||
| "mrockmadhouse"
|
||||
| "eddiescream"
|
||||
| "ripbozo"
|
||||
| "factorioalert";
|
||||
|
||||
export type soundAlert = alertBase<"sound"> & {
|
||||
sound: soundAlerts;
|
||||
|
||||
BIN
src/web/alerts/www/public/factorioalert.ogg
Executable file
BIN
src/web/alerts/www/public/factorioalert.ogg
Executable file
Binary file not shown.
Reference in New Issue
Block a user