virello 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BREAKING_CHANGES.md +19 -0
- package/README.md +15 -15
- package/docs/console-logging.md +25 -25
- package/docs/engine.md +8 -8
- package/docs/sharding-recovery.md +3 -3
- package/docs/sharding-scaling.md +2 -2
- package/docs/sharding-stats.md +3 -3
- package/examples/README.md +12 -12
- package/examples/bot.ts +2 -2
- package/examples/client.ts +4 -4
- package/examples/commands/ping.ts +1 -1
- package/examples/commands/shard.ts +2 -2
- package/examples/commands/stats.ts +2 -2
- package/examples/config.ts +1 -1
- package/examples/contracts.ts +1 -1
- package/examples/coordinator.ts +1 -1
- package/examples/engine/live.ts +3 -3
- package/examples/engine/offline.ts +2 -2
- package/examples/host.ts +1 -1
- package/examples/listeners/ready.ts +2 -2
- package/examples/logging.ts +1 -1
- package/examples/offline.ts +2 -2
- package/examples/registration.ts +2 -2
- package/examples/shutdown.ts +1 -1
- package/examples/stats.ts +1 -1
- package/package.json +2 -2
- package/src/commands/checks/containers/Entry.ts +3 -3
- package/src/commands/registration/computeDifferences/option/channelTypes.ts +1 -1
- package/src/commands/registration/computeDifferences/option/type.ts +2 -2
- package/src/commands/registration/computeDifferences/options.ts +3 -3
- package/src/commands/types.ts +1 -1
- package/src/core/Container.ts +5 -5
- package/src/core/client/{RiloClient.ts → VirelloClient.ts} +24 -19
- package/src/core/config/extensions.ts +1 -1
- package/src/core/index.ts +1 -1
- package/src/core/lifecycle/Extension.ts +5 -5
- package/src/core/loading/constants.ts +1 -1
- package/src/core/logging/LoggerLike.ts +5 -5
- package/src/core/logging/console.ts +9 -9
- package/src/core/logging/format.ts +3 -3
- package/src/core/runtime.ts +1 -1
- package/src/engine/gateway/GatewayShard.ts +2 -2
- package/src/engine/rest/RestClient.ts +2 -1
- package/src/events/events.ts +74 -59
- package/src/extensions/localisation/extension.ts +2 -2
- package/src/extensions/patternCommands/extension.ts +2 -2
- package/src/extensions/scheduledTasks/backends/RedisBackend.ts +1 -1
- package/src/extensions/scheduledTasks/extension.ts +2 -2
- package/src/extensions/scheduledTasks/types/TaskTypes.ts +1 -1
- package/src/extensions/services/extension.ts +2 -2
- package/src/extensions/subcommands/extension.ts +2 -2
- package/src/index.ts +1 -1
- package/src/public/client.ts +2 -2
- package/src/sharding/client/Link.ts +5 -5
- package/src/sharding/client/gateway.ts +1 -1
- package/src/sharding/coordinator/Coordinator.ts +4 -4
- package/src/sharding/manager/Manager.ts +6 -6
- package/src/sharding/stats.ts +1 -1
- package/src/sharding/types.ts +3 -3
- package/src/utilities/collections/bitfield/BitField.ts +1 -1
- package/src/utilities/decorators/module-decorators.ts +1 -1
- package/src/utilities/discord/pagination/PaginatedMessage.ts +10 -10
- package/src/utilities/discord/pagination/Pagination.ts +1 -1
- package/src/utilities/discord/snowflake/Snowflake.ts +5 -5
- package/src/utilities/parsing/strategies/FlagUnorderedStrategy.ts +1 -1
- package/src/utilities/result/Option.ts +2 -2
- package/src/utilities/result/Result.ts +3 -3
|
@@ -76,7 +76,7 @@ export class PaginatedMessage {
|
|
|
76
76
|
/** The default actions of this handler. */
|
|
77
77
|
public static defaultActions: PaginatedMessageAction[] = [
|
|
78
78
|
{
|
|
79
|
-
customId: "
|
|
79
|
+
customId: "virello/pagination.goToPage",
|
|
80
80
|
type: ComponentType.StringSelect,
|
|
81
81
|
options: [],
|
|
82
82
|
run: ({ handler, interaction }) =>
|
|
@@ -84,14 +84,14 @@ export class PaginatedMessage {
|
|
|
84
84
|
(handler.index = parseInt(interaction.values[0], 10)),
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
|
-
customId: "
|
|
87
|
+
customId: "virello/pagination.firstPage",
|
|
88
88
|
style: ButtonStyle.Primary,
|
|
89
89
|
emoji: "⏪",
|
|
90
90
|
type: ComponentType.Button,
|
|
91
91
|
run: ({ handler }) => (handler.index = 0),
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
|
-
customId: "
|
|
94
|
+
customId: "virello/pagination.previousPage",
|
|
95
95
|
style: ButtonStyle.Primary,
|
|
96
96
|
emoji: "◀️",
|
|
97
97
|
type: ComponentType.Button,
|
|
@@ -104,7 +104,7 @@ export class PaginatedMessage {
|
|
|
104
104
|
},
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
|
-
customId: "
|
|
107
|
+
customId: "virello/pagination.nextPage",
|
|
108
108
|
style: ButtonStyle.Primary,
|
|
109
109
|
emoji: "▶️",
|
|
110
110
|
type: ComponentType.Button,
|
|
@@ -117,14 +117,14 @@ export class PaginatedMessage {
|
|
|
117
117
|
},
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
|
-
customId: "
|
|
120
|
+
customId: "virello/pagination.goToLastPage",
|
|
121
121
|
style: ButtonStyle.Primary,
|
|
122
122
|
emoji: "⏩",
|
|
123
123
|
type: ComponentType.Button,
|
|
124
124
|
run: ({ handler }) => (handler.index = handler.pages.length - 1),
|
|
125
125
|
},
|
|
126
126
|
{
|
|
127
|
-
customId: "
|
|
127
|
+
customId: "virello/pagination.stop",
|
|
128
128
|
style: ButtonStyle.Danger,
|
|
129
129
|
emoji: "⏹️",
|
|
130
130
|
type: ComponentType.Button,
|
|
@@ -141,8 +141,8 @@ export class PaginatedMessage {
|
|
|
141
141
|
public static emitPartialDMChannelWarning = true;
|
|
142
142
|
|
|
143
143
|
/** A list of `customId` that are bound to actions that will stop the {@link PaginatedMessage}
|
|
144
|
-
* @default ['
|
|
145
|
-
public static stopPaginatedMessageCustomIds = ["
|
|
144
|
+
* @default ['virello/pagination.stop'] */
|
|
145
|
+
public static stopPaginatedMessageCustomIds = ["virello/pagination.stop"];
|
|
146
146
|
|
|
147
147
|
/** The reasons sent by {@linkplain https://discord.js.org/docs/packages/discord.js/main/InteractionCollector:Class#end InteractionCollector#end} event when the message (or its owner) has been deleted. */
|
|
148
148
|
public static deletionStopReasons = [
|
|
@@ -1050,7 +1050,7 @@ export class PaginatedMessage {
|
|
|
1050
1050
|
if (isMessageStringSelectInteractionData(interaction)) {
|
|
1051
1051
|
return new StringSelectMenuBuilder({
|
|
1052
1052
|
...interaction,
|
|
1053
|
-
...(interaction.customId === "
|
|
1053
|
+
...(interaction.customId === "virello/pagination.goToPage" && {
|
|
1054
1054
|
options: await Promise.all(
|
|
1055
1055
|
this.pages.map(async (_, index) => {
|
|
1056
1056
|
return {
|
|
@@ -1071,7 +1071,7 @@ export class PaginatedMessage {
|
|
|
1071
1071
|
}
|
|
1072
1072
|
|
|
1073
1073
|
throw new Error(
|
|
1074
|
-
"Unsupported message component type detected. Validate your code and if you're sure this is a bug in
|
|
1074
|
+
"Unsupported message component type detected. Validate your code and if you're sure this is a bug in Virello make a report in the server",
|
|
1075
1075
|
);
|
|
1076
1076
|
},
|
|
1077
1077
|
),
|
|
@@ -124,7 +124,7 @@ export class Pagination {
|
|
|
124
124
|
private readonly entries: readonly string[];
|
|
125
125
|
private readonly options: PaginationBaseOptions;
|
|
126
126
|
private readonly mode: Mode;
|
|
127
|
-
private readonly prefix = `
|
|
127
|
+
private readonly prefix = `virello:${randomUUIDv7()}:`;
|
|
128
128
|
private readonly size: number;
|
|
129
129
|
private readonly pages: number;
|
|
130
130
|
private pageIndex = 0;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const IncrementSymbol = Symbol("
|
|
2
|
-
const EpochSymbol = Symbol("
|
|
3
|
-
const EpochNumberSymbol = Symbol("
|
|
4
|
-
const ProcessIdSymbol = Symbol("
|
|
5
|
-
const WorkerIdSymbol = Symbol("
|
|
1
|
+
const IncrementSymbol = Symbol("virello/snowflake.increment");
|
|
2
|
+
const EpochSymbol = Symbol("virello/snowflake.epoch");
|
|
3
|
+
const EpochNumberSymbol = Symbol("virello/snowflake.epoch.number");
|
|
4
|
+
const ProcessIdSymbol = Symbol("virello/snowflake.processId");
|
|
5
|
+
const WorkerIdSymbol = Symbol("virello/snowflake.workerId");
|
|
6
6
|
|
|
7
7
|
/** The maximum value the `workerId` field accepts in snowflakes. */
|
|
8
8
|
export const MaximumWorkerId = 0b11111n;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Option } from "../../result/index";
|
|
2
2
|
import { PrefixedStrategy } from "../index";
|
|
3
3
|
|
|
4
|
-
/** The strategy options used in
|
|
4
|
+
/** The strategy options used in Virello. */
|
|
5
5
|
export interface FlagStrategyOptions {
|
|
6
6
|
/** Accepted key-only flags. Use true to allow any name, or false/an empty list to disable flags. Defaults to an empty list. */
|
|
7
7
|
flags?: readonly string[] | boolean;
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
import { OptionError } from "./OptionError";
|
|
8
8
|
import { type Err, err, type Ok, ok, Result } from "./Result";
|
|
9
9
|
|
|
10
|
-
const ValueProperty = Symbol.for("
|
|
11
|
-
const ExistsProperty = Symbol.for("
|
|
10
|
+
const ValueProperty = Symbol.for("virello/result:Option.value");
|
|
11
|
+
const ExistsProperty = Symbol.for("virello/result:Option.exists");
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Some(value) or None. Some can contain null or undefined explicitly; from() converts nullish values to None. Ordinary
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
import { type None, none, type Option, type Some, some } from "./Option";
|
|
8
8
|
import { ResultError } from "./ResultError";
|
|
9
9
|
|
|
10
|
-
const ValueProperty = Symbol.for("
|
|
11
|
-
const SuccessProperty = Symbol.for("
|
|
10
|
+
const ValueProperty = Symbol.for("virello/result:Result.value");
|
|
11
|
+
const SuccessProperty = Symbol.for("virello/result:Result.success");
|
|
12
12
|
/** Symbol used to delegate safe unwrapping inside safeTry generators. */
|
|
13
|
-
const UnwrapSafeProperty = Symbol.for("
|
|
13
|
+
const UnwrapSafeProperty = Symbol.for("virello/result:Result.safeUnwrap");
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* An Ok value or Err error. Create one with Result.ok/err. Ordinary callbacks run synchronously and propagate exceptions;
|