Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inconsistencies in types #175

Merged
merged 2 commits into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 3 additions & 4 deletions src/commands/general/config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { getUser, insertData } from "@utils/database";
import { ScoreEmbed } from "@type/database";
import { ApplicationCommandOptionType } from "lilybird";
import type { ApplicationCommandData, GuildInteraction, Interaction } from "@lilybird/transformers";
import type { ApplicationCommandData, GuildInteraction } from "@lilybird/transformers";
import type { EmbedStructure } from "lilybird";
import type { SlashCommand } from "@lilybird/handlers";
import type { SlashCommand } from "@type/commands";

export default {
post: "GLOBAL",
data: {
name: "config",
description: "Set your account configurations",
Expand Down Expand Up @@ -37,7 +36,7 @@ export default {
run
} satisfies SlashCommand;

async function run(interaction: Interaction<ApplicationCommandData>): Promise<void> {
async function run(interaction: GuildInteraction<ApplicationCommandData>): Promise<void> {
await interaction.deferReply();
if (!interaction.inGuild()) return;

Expand Down
3 changes: 1 addition & 2 deletions src/commands/general/ping.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { client } from "@utils/initalize";
import type { SlashCommand } from "@lilybird/handlers";
import type { SlashCommand } from "@type/commands";

export default {
post: "GLOBAL",
data: { name: "ping", description: "pong!!" },
run: async (interaction) => {
await interaction.deferReply();
Expand Down
7 changes: 3 additions & 4 deletions src/commands/general/prefix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { getServer, insertData } from "@utils/database";
import { DEFAULT_PREFIX, MAX_AMOUNT_OF_PREFIXES } from "@utils/constants";
import { prefixesCache } from "@listeners/guildCreate";
import { ApplicationCommandOptionType, EmbedType, PermissionFlags } from "lilybird";
import type { ApplicationCommandData, GuildInteraction, Interaction } from "@lilybird/transformers";
import type { SlashCommand } from "@lilybird/handlers";
import type { ApplicationCommandData, GuildInteraction } from "@lilybird/transformers";
import type { SlashCommand } from "@type/commands";

const commands: Record<string, ({ prefix, interaction, guildId }: { prefix?: string, interaction: GuildInteraction<ApplicationCommandData>, guildId: string }) => Promise<void>> = {
add,
Expand All @@ -21,7 +21,6 @@ const PERMISSIONS_NEEDED = PermissionNames[Number(PERMISSIONS_NEEDED_INT)];
const PERMISSION_NEEDED_STRING = `Looks like you don't have the necessary permissions for this command. Permission(s) needed: \`${PERMISSIONS_NEEDED}\``;

export default {
post: "GLOBAL",
data: {
name: "prefix",
description: "Set, remove and list the bot's prefixes",
Expand All @@ -48,7 +47,7 @@ export default {
run
} satisfies SlashCommand;

async function run(interaction: Interaction<ApplicationCommandData>): Promise<void> {
async function run(interaction: GuildInteraction<ApplicationCommandData>): Promise<void> {
await interaction.deferReply();
if (!interaction.inGuild()) return;

Expand Down
3 changes: 1 addition & 2 deletions src/commands/help/help.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { helpBuilder } from "@builders/help";
import type { SlashCommand } from "@lilybird/handlers";
import type { SlashCommand } from "@type/commands";

export default {
post: "GLOBAL",
data: { name: "help", description: "Get info about the bot." },
run: async (interaction) => {
await interaction.deferReply();
Expand Down
8 changes: 3 additions & 5 deletions src/commands/osu/avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import { UserType } from "@type/commandArgs";
import { EmbedBuilderType } from "@type/embedBuilders";
import { avatarBuilder } from "@builders/avatar";
import { ApplicationCommandOptionType, EmbedType } from "lilybird";
import type { ApplicationCommandData, Interaction } from "@lilybird/transformers";
import type { SlashCommand } from "@lilybird/handlers";
import type { ApplicationCommandData, GuildInteraction } from "@lilybird/transformers";
import type { SlashCommand } from "@type/commands";

export default {
post: "GLOBAL",
data: {
name: "avatar",
description: "Display the avatar of a user.",
Expand All @@ -28,8 +27,7 @@ export default {
run
} satisfies SlashCommand;

async function run(interaction: Interaction<ApplicationCommandData>): Promise<void> {
if (!interaction.inGuild()) return;
async function run(interaction: GuildInteraction<ApplicationCommandData>): Promise<void> {
await interaction.deferReply();

const args = getCommandArgs(interaction);
Expand Down
8 changes: 3 additions & 5 deletions src/commands/osu/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import { EmbedBuilderType } from "@type/embedBuilders";
import { backgroundBuilder } from "@builders/background";
import { client } from "@utils/initalize";
import { ApplicationCommandOptionType, EmbedType } from "lilybird";
import type { ApplicationCommandData, Interaction } from "@lilybird/transformers";
import type { SlashCommand } from "@lilybird/handlers";
import type { ApplicationCommandData, GuildInteraction } from "@lilybird/transformers";
import type { SlashCommand } from "@type/commands";

export default {
post: "GLOBAL",
data: {
name: "background",
description: "Display background of a beatmap.",
Expand All @@ -23,8 +22,7 @@ export default {
run
} satisfies SlashCommand;

async function run(interaction: Interaction<ApplicationCommandData>): Promise<void> {
if (!interaction.inGuild()) return;
async function run(interaction: GuildInteraction<ApplicationCommandData>): Promise<void> {
await interaction.deferReply();

const args = getCommandArgs(interaction);
Expand Down
8 changes: 3 additions & 5 deletions src/commands/osu/banner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import { client } from "@utils/initalize";
import { UserType } from "@type/commandArgs";
import { EmbedBuilderType } from "@type/embedBuilders";
import { ApplicationCommandOptionType, EmbedType } from "lilybird";
import type { ApplicationCommandData, Interaction } from "@lilybird/transformers";
import type { SlashCommand } from "@lilybird/handlers";
import type { ApplicationCommandData, GuildInteraction } from "@lilybird/transformers";
import type { SlashCommand } from "@type/commands";

export default {
post: "GLOBAL",
data: {
name: "banner",
description: "Display the banner of a user.",
Expand All @@ -28,8 +27,7 @@ export default {
run
} satisfies SlashCommand;

async function run(interaction: Interaction<ApplicationCommandData>): Promise<void> {
if (!interaction.inGuild()) return;
async function run(interaction: GuildInteraction<ApplicationCommandData>): Promise<void> {
await interaction.deferReply();

const args = getCommandArgs(interaction);
Expand Down
8 changes: 3 additions & 5 deletions src/commands/osu/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import { compareBuilder } from "@builders/compare";
import { getBeatmapIdFromContext } from "@utils/osu";
import { EmbedBuilderType } from "@type/embedBuilders";
import { ApplicationCommandOptionType, EmbedType } from "lilybird";
import type { ApplicationCommandData, Interaction } from "@lilybird/transformers";
import type { SlashCommand } from "@lilybird/handlers";
import type { ApplicationCommandData, GuildInteraction } from "@lilybird/transformers";
import type { SlashCommand } from "@type/commands";

export default {
post: "GLOBAL",
data: {
name: "compare",
description: "Display play(s) of a user on a beatmap.",
Expand Down Expand Up @@ -71,8 +70,7 @@ export default {
run
} satisfies SlashCommand;

async function run(interaction: Interaction<ApplicationCommandData>): Promise<void> {
if (!interaction.inGuild()) return;
async function run(interaction: GuildInteraction<ApplicationCommandData>): Promise<void> {
await interaction.deferReply();

const args = getCommandArgs(interaction);
Expand Down
8 changes: 3 additions & 5 deletions src/commands/osu/leaderboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import { mesageDataForButtons } from "@utils/cache";
import { ApplicationCommandOptionType, EmbedType } from "lilybird";
import type { LeaderboardBuilderOptions } from "@type/embedBuilders";
import type { Mod } from "osu-web.js";
import type { ApplicationCommandData, Interaction } from "@lilybird/transformers";
import type { SlashCommand } from "@lilybird/handlers";
import type { ApplicationCommandData, GuildInteraction } from "@lilybird/transformers";
import type { SlashCommand } from "@type/commands";

export default {
post: "GLOBAL",
data: {
name: "leaderboard",
description: "Display the leaderboard of a beatmap",
Expand Down Expand Up @@ -44,8 +43,7 @@ export default {
run
} satisfies SlashCommand;

async function run(interaction: Interaction<ApplicationCommandData>): Promise<void> {
if (!interaction.inGuild()) return;
async function run(interaction: GuildInteraction<ApplicationCommandData>): Promise<void> {
await interaction.deferReply();

const args = getCommandArgs(interaction);
Expand Down
8 changes: 3 additions & 5 deletions src/commands/osu/link.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { encrypt } from "../..";
import { buildAuthUrl } from "@utils/osu";
import type { AuthScope } from "@type/osu";
import type { SlashCommand } from "@lilybird/handlers";
import type { ApplicationCommandData, Interaction } from "@lilybird/transformers";
import type { SlashCommand } from "@type/commands";
import type { ApplicationCommandData, GuildInteraction } from "@lilybird/transformers";

export default {
post: "GLOBAL",
data: { name: "link", description: "Link your osu! account to the bot." },
run
} satisfies SlashCommand;

async function run(interaction: Interaction<ApplicationCommandData>): Promise<void> {
if (!interaction.inGuild()) return;
async function run(interaction: GuildInteraction<ApplicationCommandData>): Promise<void> {
await interaction.deferReply(true);

const encryptedDiscordId = `${encrypt(interaction.member.user.id)}`;
Expand Down
8 changes: 3 additions & 5 deletions src/commands/osu/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import { mapBuilder } from "@builders/map";
import { EmbedBuilderType } from "@type/embedBuilders";
import { ApplicationCommandOptionType, EmbedType } from "lilybird";
import type { Mod } from "osu-web.js";
import type { ApplicationCommandData, Interaction } from "@lilybird/transformers";
import type { SlashCommand } from "@lilybird/handlers";
import type { ApplicationCommandData, GuildInteraction } from "@lilybird/transformers";
import type { SlashCommand } from "@type/commands";

export default {
post: "GLOBAL",
data: {
name: "map",
description: "Display statistics of a beatmap.",
Expand All @@ -29,8 +28,7 @@ export default {
run
} satisfies SlashCommand;

async function run(interaction: Interaction<ApplicationCommandData>): Promise<void> {
if (!interaction.inGuild()) return;
async function run(interaction: GuildInteraction<ApplicationCommandData>): Promise<void> {
await interaction.deferReply();

const args = getCommandArgs(interaction);
Expand Down
8 changes: 3 additions & 5 deletions src/commands/osu/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import { client } from "@utils/initalize";
import { UserType } from "@type/commandArgs";
import { EmbedBuilderType } from "@type/embedBuilders";
import { ApplicationCommandOptionType, EmbedType } from "lilybird";
import type { ApplicationCommandData, Interaction } from "@lilybird/transformers";
import type { SlashCommand } from "@lilybird/handlers";
import type { ApplicationCommandData, GuildInteraction } from "@lilybird/transformers";
import type { SlashCommand } from "@type/commands";

export default {
post: "GLOBAL",
data: {
name: "profile",
description: "Display statistics of a user.",
Expand All @@ -34,8 +33,7 @@ export default {
run
} satisfies SlashCommand;

async function run(interaction: Interaction<ApplicationCommandData>): Promise<void> {
if (!interaction.inGuild()) return;
async function run(interaction: GuildInteraction<ApplicationCommandData>): Promise<void> {
await interaction.deferReply();

const args = getCommandArgs(interaction);
Expand Down
8 changes: 3 additions & 5 deletions src/commands/osu/recent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import { mesageDataForButtons } from "@utils/cache";
import { ApplicationCommandOptionType, EmbedType } from "lilybird";
import type { PlaysBuilderOptions } from "@type/embedBuilders";
import type { Mod } from "osu-web.js";
import type { ApplicationCommandData, Interaction } from "@lilybird/transformers";
import type { SlashCommand } from "@lilybird/handlers";
import type { ApplicationCommandData, GuildInteraction } from "@lilybird/transformers";
import type { SlashCommand } from "@type/commands";

export default {
post: "GLOBAL",
data: {
name: "recent",
description: "Display recent play(s) of a user.",
Expand Down Expand Up @@ -82,8 +81,7 @@ export default {
run
} satisfies SlashCommand;

async function run(interaction: Interaction<ApplicationCommandData>): Promise<void> {
if (!interaction.inGuild()) return;
async function run(interaction: GuildInteraction<ApplicationCommandData>): Promise<void> {
await interaction.deferReply();

const args = getCommandArgs(interaction);
Expand Down
8 changes: 3 additions & 5 deletions src/commands/osu/recentbest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import { mesageDataForButtons } from "@utils/cache";
import { ApplicationCommandOptionType, EmbedType } from "lilybird";
import type { PlaysBuilderOptions } from "@type/embedBuilders";
import type { Mod } from "osu-web.js";
import type { ApplicationCommandData, Interaction } from "@lilybird/transformers";
import type { SlashCommand } from "@lilybird/handlers";
import type { ApplicationCommandData, GuildInteraction } from "@lilybird/transformers";
import type { SlashCommand } from "@type/commands";

export default {
post: "GLOBAL",
data: {
name: "recentbest",
description: "Display most recent top play(s) of a user.",
Expand Down Expand Up @@ -84,8 +83,7 @@ export default {
run
} satisfies SlashCommand;

async function run(interaction: Interaction<ApplicationCommandData>): Promise<void> {
if (!interaction.inGuild()) return;
async function run(interaction: GuildInteraction<ApplicationCommandData>): Promise<void> {
await interaction.deferReply();

const args = getCommandArgs(interaction);
Expand Down
8 changes: 3 additions & 5 deletions src/commands/osu/recentlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import { mesageDataForButtons } from "@utils/cache";
import { ApplicationCommandOptionType, EmbedType } from "lilybird";
import type { PlaysBuilderOptions } from "@type/embedBuilders";
import type { Mod } from "osu-web.js";
import type { ApplicationCommandData, Interaction } from "@lilybird/transformers";
import type { SlashCommand } from "@lilybird/handlers";
import type { ApplicationCommandData, GuildInteraction } from "@lilybird/transformers";
import type { SlashCommand } from "@type/commands";

export default {
post: "GLOBAL",
data: {
name: "recentlist",
description: "Display a list of recent play(s) of a user.",
Expand Down Expand Up @@ -89,8 +88,7 @@ export default {
run
} satisfies SlashCommand;

async function run(interaction: Interaction<ApplicationCommandData>): Promise<void> {
if (!interaction.inGuild()) return;
async function run(interaction: GuildInteraction<ApplicationCommandData>): Promise<void> {
await interaction.deferReply();

const args = getCommandArgs(interaction);
Expand Down
8 changes: 3 additions & 5 deletions src/commands/osu/top.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import { mesageDataForButtons } from "@utils/cache";
import { ApplicationCommandOptionType, EmbedType } from "lilybird";
import type { PlaysBuilderOptions } from "@type/embedBuilders";
import type { Mod } from "osu-web.js";
import type { ApplicationCommandData, Interaction } from "@lilybird/transformers";
import type { SlashCommand } from "@lilybird/handlers";
import type { ApplicationCommandData, GuildInteraction } from "@lilybird/transformers";
import type { SlashCommand } from "@type/commands";

export default {
post: "GLOBAL",
data: {
name: "top",
description: "Display top play(s) of a user.",
Expand Down Expand Up @@ -84,8 +83,7 @@ export default {
run
} satisfies SlashCommand;

async function run(interaction: Interaction<ApplicationCommandData>): Promise<void> {
if (!interaction.inGuild()) return;
async function run(interaction: GuildInteraction<ApplicationCommandData>): Promise<void> {
await interaction.deferReply();

const args = getCommandArgs(interaction);
Expand Down
8 changes: 3 additions & 5 deletions src/commands/osu/unlink.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { getUser, removeUser } from "@utils/database";
import { slashCommandsIds } from "@utils/cache";
import type { SlashCommand } from "@lilybird/handlers";
import type { ApplicationCommandData, Interaction } from "@lilybird/transformers";
import type { SlashCommand } from "@type/commands";
import type { ApplicationCommandData, GuildInteraction } from "@lilybird/transformers";

export default {
post: "GLOBAL",
data: { name: "unlink", description: "Unlink your osu! account from the bot." },
run
} satisfies SlashCommand;

async function run(interaction: Interaction<ApplicationCommandData>): Promise<void> {
if (!interaction.inGuild()) return;
async function run(interaction: GuildInteraction<ApplicationCommandData>): Promise<void> {
await interaction.deferReply(true);

const linkCommand = slashCommandsIds.get("link");
Expand Down
Loading
Loading