feat: implemented dist package.json

This commit is contained in:
TresAbhi committed 2023-06-30 17:38:44 +00:00
1 parent e34a6c6e4b
commit 4c2b0253de
7 files changed
+46 -29

No files matched your search

+1 -1
View File
@@ -20,7 +20,7 @@ import { AccountInfo } from '../types/accountInfo.js';
export default {
inProduction: true,
inDevelopment: false,
inDevelopment: true,
inPublic: true,
command: addStatTypeSubCommandGroups(
+2 -2
View File
@@ -1,13 +1,13 @@
import { times } from 'lodash';
import { theme } from '../../../stitches.config.js';
import { MarginProps as RootMarginProps } from './Root.js';
import { MarginInputProps } from './Root.js';
export enum MarginOrientation {
Vertical,
Horizontal,
}
export interface MarginProps extends RootMarginProps {
export interface MarginProps extends MarginInputProps {
verticalSeparations: number;
orientation?: MarginOrientation;
}
+3 -3
View File
@@ -6,7 +6,7 @@ import { Margin, MarginOrientation } from './Margin.js';
export const GRAPH_WIDTH = 544;
export const GRAPH_HEIGHT = 320;
export interface MarginProps {
export interface MarginInputProps {
min: number;
max: number;
suffix?: string;
@@ -15,8 +15,8 @@ export interface MarginProps {
export interface RootProps {
children: ReactNode;
verticalMargin?: MarginProps;
horizontalMargin?: MarginProps;
verticalMargin?: MarginInputProps;
horizontalMargin?: MarginInputProps;
separations?: number;
xMinLabel: string;
xMaxLabel: string;
+1 -1
View File
@@ -1,3 +1,3 @@
export default function throwError(message: string, cause: string) {
export default function throwError(message: string, cause?: string) {
return new Error(message, { cause });
}
@@ -1,21 +1,31 @@
import { ButtonInteraction, CacheType } from 'discord.js';
import { CYCLIC_API } from '../../../constants/cyclic.js';
import normalizeInteractionReturnable from '../../../core/discord/normalizeInteractionReturnable.js';
import throwError from '../../../core/node/throwError.js';
import { commands } from '../index.js';
export default async function handleButton(
interaction: ButtonInteraction<CacheType>,
) {
await interaction.deferUpdate();
const url = new URL(`${CYCLIC_API}/${interaction.customId}`);
const commandName = url.pathname.split('/')[1];
const button = commands[commandName]?.button;
if (!button) {
console.error(`Button handler not found for "${commandName}"`);
throwError(`Button handler not found for "${commandName}"`);
return;
}
if (interaction.message.interaction?.user.id !== interaction.user.id) {
interaction.followUp({
ephemeral: true,
content: 'You are not the author of this command.',
});
return;
}
await interaction.deferUpdate();
await interaction.message.edit(
await normalizeInteractionReturnable(button(interaction)),
);