Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
4d37b29
wip
Supinic Jun 17, 2025
c62246f
wip 4
Supinic Jun 19, 2025
8222ee8
wip
Supinic Jun 21, 2025
3aa9ce7
Merge branch 'master' into alias-to-subcommands
Supinic Jun 24, 2025
634536d
wip - use new type imports from top command
Supinic Jun 24, 2025
017dd87
wip 4
Supinic Jun 24, 2025
283ae4e
wip 5 - `transfer`
Supinic Jun 24, 2025
a578f92
wip 6 - restrict
Supinic Jun 24, 2025
ff8f377
wip 7 - inspect
Supinic Jun 24, 2025
9aa87c5
wip 8 - `describe`
Supinic Jun 24, 2025
d6b84a2
wip 9 - `copy`
Supinic Jun 24, 2025
d8fa26c
wip 10 - `edit`
Supinic Jun 24, 2025
44f6e54
wip 11 - `remove`
Supinic Jun 24, 2025
db5fbf6
wip 12 - `duplicate`
Supinic Jun 24, 2025
e564343
wip 13 - `link`
Supinic Jun 24, 2025
ea51ef0
wip 14 - `check` fixes
Supinic Jun 24, 2025
3da370b
wip 15 - finalize
Supinic Jun 24, 2025
e42644c
wip 16 - linting
Supinic Jun 24, 2025
0b60e59
wip 17 - import correct file
Supinic Jun 24, 2025
ec1a3e2
wip 18 - change `prefix` imports
Supinic Jun 24, 2025
0bb3838
wip - tests
Supinic Jun 25, 2025
8033238
testing system wip
Supinic Jun 29, 2025
ee917e2
Merge branch 'master' into alias-to-subcommands
Supinic Aug 5, 2025
dc5d65b
wip
Supinic Aug 7, 2025
712f694
fix newly-async call
Supinic Aug 19, 2025
ddbc3d7
Merge branch 'master' into alias-to-subcommands
Supinic Aug 19, 2025
a397502
wip
Supinic Aug 19, 2025
59e932e
Merge branch 'master' into alias-to-subcommands
Supinic Aug 20, 2025
58f86a1
Merge branch 'master' into alias-to-subcommands
Supinic Aug 20, 2025
deb2769
wip
Supinic Aug 22, 2025
2cf1e2a
wip - testing, works now mostly
Supinic Aug 23, 2025
e08f732
minor adjustments
Supinic Aug 24, 2025
8f0a278
roadmap for alias tests
Supinic Aug 24, 2025
022b65d
Merge branch 'master' into alias-to-subcommands
Supinic Aug 26, 2025
833aa95
bump `yarn.lock`
Supinic Aug 26, 2025
63f6d09
wip
Supinic Aug 27, 2025
5c97474
added test skips
Supinic Sep 2, 2025
94a2319
test-utils fixes, new structure for existing suites
Supinic Sep 3, 2025
ada75b8
adjustments - use `world.rows.pop` and check rows length
Supinic Sep 5, 2025
bc7ef22
add `$alias copy` tests
Supinic Sep 9, 2025
cb3d5c7
prepare more tests for `$alias check`
Supinic Sep 9, 2025
b3b706f
trying out coverage skips
Supinic Sep 9, 2025
24f3aa2
wip
Supinic Sep 16, 2025
74a2ea4
Merge branch 'master' into alias-to-subcommands
Supinic Sep 19, 2025
4e1d93b
Merge branch 'master' into alias-to-subcommands
Supinic Sep 19, 2025
a27740b
Merge branch 'master' into alias-to-subcommands
Supinic Sep 24, 2025
e8ece46
use `verbatimModuleSyntax: true`
Supinic Sep 24, 2025
da8d774
Merge branch 'master' into alias-to-subcommands
Supinic Sep 30, 2025
7cc78c8
wip (not working)
Supinic Oct 3, 2025
6688577
Merge branch 'master' into alias-to-subcommands
Supinic Oct 7, 2025
1f03c19
wip
Supinic Oct 14, 2025
850bc1f
minor refactor, added subtests
Supinic Oct 14, 2025
96a0b70
ignore assert error for coverage
Supinic Oct 14, 2025
4d014a4
improve test utils + $alias link tests
Supinic Oct 14, 2025
bac1779
wip
Supinic Oct 21, 2025
c30d1ec
Merge branch 'master' into alias-to-subcommands
Supinic Oct 21, 2025
0aeeb38
wip alias publish
Supinic Oct 21, 2025
0ef1ad5
upgrade testing utils to support rows loading their own data
Supinic Oct 22, 2025
d8447e2
wip
Supinic Oct 24, 2025
6572461
added publish, unpublish, published
Supinic Oct 26, 2025
c6eaa92
added `rename`
Supinic Oct 26, 2025
976bf1c
added `restrict`
Supinic Oct 26, 2025
4426a14
re-added(?) `remove`
Supinic Oct 28, 2025
f88b4dd
added `run/try`, still wip
Supinic Oct 28, 2025
f2058a4
wip `run/try`
Supinic Oct 28, 2025
d038fe1
wip: `run/try`
Supinic Oct 28, 2025
e77aad1
`$alias run` wip
Supinic Nov 4, 2025
1790806
partial `transfer` tests
Supinic Nov 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ config.json
.nyc_output
.yarn
yarn-error.log
coverage
.coverage
build

docker-compose.yml
Expand Down
12 changes: 6 additions & 6 deletions classes/channel.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import EventEmitter from "node:events";
import { SupiError, SupiDate } from "supi-core";
import { SupiError, type SupiDate } from "supi-core";

import {
Platform,
Like as PlatformLike,
GenericSendOptions,
PrepareMessageOptions
type Like as PlatformLike,
type GenericSendOptions,
type PrepareMessageOptions
} from "../platforms/template.js";

import {
Expand All @@ -17,10 +17,10 @@ import {
saveChannelDataProperty
} from "./custom-data-properties.js";

import { User } from "./user.js";
import type { User } from "./user.js";
import createMessageLoggingTable from "../utils/create-db-table.js";
import { TemplateWithId } from "./template.js";
import { Emote } from "../@types/globals.js";
import type { Emote } from "../@types/globals.js";

export const privateMessageChannelSymbol /* : unique symbol */ = Symbol("private-message-channel");

Expand Down
4 changes: 2 additions & 2 deletions classes/chat-module.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { SupiError } from "supi-core";

import { TemplateWithoutId } from "./template.js";
import { Channel, Like as ChannelLike } from "./channel.js";
import { User } from "./user.js";
import { Channel, type Like as ChannelLike } from "./channel.js";

import type { User } from "./user.js";
import { Platform } from "../platforms/template.js";
import type { SimpleGenericData, XOR } from "../@types/globals.d.ts";
import type { TwitchPlatform } from "../platforms/twitch.js";
Expand Down
52 changes: 23 additions & 29 deletions classes/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,22 @@ import { getConfig } from "../config.js";

type DiscordEmbeds = BaseMessageOptions["embeds"];

import { TemplateWithoutId, TemplateDefinition } from "./template.js";
import { TemplateWithoutId, type TemplateDefinition } from "./template.js";

import Banphrase from "./banphrase.js";
import { Banphrase } from "./banphrase.js";
import { Filter } from "./filter.js";
import {
User,
permissions as userPermissions,
permissionNames as userPermissionNames,
type PermissionNumbers
} from "./user.js";
import { Channel, privateMessageChannelSymbol } from "./channel.js";
import { Platform, type GetEmoteOptions } from "../platforms/template.js";
import CooldownManager from "../utils/cooldown-manager.js";
import { type Language, getLanguage } from "../utils/languages.js";
import { type Channel, privateMessageChannelSymbol } from "./channel.js";
import { permissions as userPermissions, permissionNames as userPermissionNames, type PermissionNumbers, type User } from "./user.js";

import type { Platform, GetEmoteOptions } from "../platforms/template.js";
import type { MessageData as TwitchAppendData } from "../platforms/twitch.js";
import type { MessageData as DiscordAppendData } from "../platforms/discord.js";

import CooldownManager from "../utils/cooldown-manager.js";
import { type Language, getLanguage } from "../utils/languages.js";

import { whitespaceRegex } from "../utils/regexes.js";
import { Emote } from "../@types/globals.js";
import type { Emote } from "../@types/globals.js";

const { values: configValues, modules: modulesConfig, responses: configResponses } = getConfig();
const COMMAND_PREFIX = modulesConfig.commands.prefix;
Expand Down Expand Up @@ -108,19 +104,24 @@ export type ContextData<T extends ParameterDefinitions = ParameterDefinitions> =
params?: Context<T>["params"];
};
export type ContextAppendData = {
tee?: Invocation[];
pipe?: boolean;
alias?: boolean;
aliasArgs?: readonly string[];
aliasCount?: number;
commandList?: Command["Name"][];
aliasStack?: Command["Name"][];
aliasTry?: {
userName?: User["Name"];
};
badges?: unknown;
commandList?: Command["Name"][];
emotes?: unknown;
flags?: unknown;
id?: string;
messageID?: string;
badges?: unknown;
emotes?: unknown;
skipPending?: boolean;
privateMessage?: boolean;
pipe?: boolean;
platform?: never; // @todo this is a temporary check for refactor purposes
privateMessage?: boolean;
skipPending?: boolean;
tee?: Invocation[];
};
export type ContextPlatformSpecificData = TwitchAppendData | DiscordAppendData | null;

Expand Down Expand Up @@ -294,7 +295,7 @@ export type DescriptionFunction = (this: Command, prefix: string) => string[] |
export type CustomInitFunction = (this: Command) => Promise<void> | void;
export type CustomDestroyFunction = (this: Command) => void;

type ExecuteOptions = {
export type ExecuteOptions = ContextAppendData & {
skipPending?: boolean;
privateMessage?: boolean;
skipBanphrases?: boolean;
Expand Down Expand Up @@ -325,13 +326,6 @@ export interface SubcommandDefinition<T extends CommandDefinition = CommandDefin
flags?: Record<string, boolean>;
execute: (this: Command, context: Context<T["Params"]>, ...args: string[]) => StrictResult | Promise<StrictResult>;
}

export const createSubcommandBinding = <
T extends CommandDefinition
> () => <
D extends SubcommandDefinition<T>
> (def: D) => def;

export class SubcommandCollection {
public readonly name: string;
public readonly names: readonly string[];
Expand Down Expand Up @@ -393,7 +387,7 @@ export class Command extends TemplateWithoutId {
readonly Aliases: string[];
readonly Description: string | null;
readonly Cooldown: number | null;
readonly Flags: Readonly<Flag[]>;
readonly Flags: readonly Flag[];
readonly Params: ParameterDefinitions = [];
readonly Whitelist_Response: string | null;
readonly Code: ExecuteFunction;
Expand Down
2 changes: 1 addition & 1 deletion classes/custom-data-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { User } from "./user.js";
import type { SimpleGenericData } from "../@types/globals.js";
import type { Query } from "supi-core";

import { flags as twitchLottoFlags } from "../commands/twitchlotto/definitions.js";
import type { flags as twitchLottoFlags } from "../commands/twitchlotto/definitions.js";
type TwitchLottoFlagName = typeof twitchLottoFlags[number]["name"];

type PoolConnection = Awaited<ReturnType<Query["getTransaction"]>>;
Expand Down
6 changes: 3 additions & 3 deletions classes/filter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { SupiError } from "supi-core";
import { TemplateWithId } from "./template.js";

import { Channel, isChannel, privateMessageChannelSymbol } from "./channel.js";
import User from "./user.js";
import type Platform from "../platforms/template.js";
import { type Channel, isChannel, privateMessageChannelSymbol } from "./channel.js";
import { User } from "./user.js";
import type { Platform } from "../platforms/template.js";
import type { Command } from "./command.js";
import type { XOR } from "../@types/globals.d.ts";
import { TWITCH_ANTIPING_CHARACTER } from "../utils/command-utils.js";
Expand Down
12 changes: 12 additions & 0 deletions classes/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,18 @@ export class User extends TemplateWithIdString {
}
}

static async getAsserted (identifier: string | number): Promise<User> {
const userData = await User.get(identifier, true);
if (!userData) {
throw new SupiError({
message: "Assert error: User.getAsserted did not find User",
args: { identifier }
});
}

return userData;
}

static async getMultiple (identifiers: Like[]) {
const result: User[] = [];
const toFetch: (string | number)[] = [];
Expand Down
2 changes: 1 addition & 1 deletion commands/about/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SupiDate, SupiError } from "supi-core";
import { type SupiDate, SupiError } from "supi-core";
import { declare } from "../../classes/command.js";

export default declare({
Expand Down
105 changes: 0 additions & 105 deletions commands/alias/alias-utils.js

This file was deleted.

Loading