Skip to content

Commit

Permalink
Invite and vote command (#189)
Browse files Browse the repository at this point in the history
* split builders into groups

* add new vote link to help embed

* add invite and vote commands
  • Loading branch information
Yoru authored Apr 21, 2024
1 parent 3729645 commit 738d026
Show file tree
Hide file tree
Showing 18 changed files with 78 additions and 13 deletions.
18 changes: 18 additions & 0 deletions src/commands-message/general/invite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { MessageCommand } from "@type/commands";
import type { Message } from "@lilybird/transformers";

export default {
name: "invite",
description: "Get an invite link of the bot.",
cooldown: 1000,
run: async ({ message }: { message: Message }) => {
const links = {
invite: "https://discord.com/oauth2/authorize?client_id=995999045157916763&permissions=265216&scope=bot",
vote: "https://top.gg/bot/995999045157916763"
};

await message.reply({
content: `You can invite the bot to your server using the following link:\n${links.invite}\nYou can also vote for the bot:\n${links.vote}`
});
}
} satisfies MessageCommand;
15 changes: 15 additions & 0 deletions src/commands-message/general/vote.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { MessageCommand } from "@type/commands";
import type { Message } from "@lilybird/transformers";

export default {
name: "vote",
description: "Vote for the bot.",
cooldown: 1000,
run: async ({ message }: { message: Message }) => {
const voteLink = "https://top.gg/bot/995999045157916763";

await message.reply({
content: `You can vote for the bot using the following link:\n${voteLink}`
});
}
} satisfies MessageCommand;
2 changes: 1 addition & 1 deletion src/commands-message/help/help.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { helpBuilder } from "@builders/help";
import { helpBuilder } from "@builders/index";
import type { MessageCommand } from "@type/commands";
import type { Message } from "@lilybird/transformers";

Expand Down
2 changes: 1 addition & 1 deletion src/commands-message/osu/avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { client } from "@utils/initalize";
import { UserType } from "@type/commandArgs";
import { EmbedBuilderType } from "@type/embedBuilders";
import { Mode } from "@type/osu";
import { avatarBuilder } from "@builders/avatar";
import { avatarBuilder } from "@builders/index";
import { EmbedType } from "lilybird";
import type { GuildTextChannel, Message } from "@lilybird/transformers";
import type { MessageCommand } from "@type/commands";
Expand Down
2 changes: 1 addition & 1 deletion src/commands-message/osu/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getBeatmapIdFromContext } from "@utils/osu";
import { Mode } from "@type/osu";
import { EmbedBuilderType } from "@type/embedBuilders";
import { client } from "@utils/initalize";
import { backgroundBuilder } from "@builders/background";
import { backgroundBuilder } from "@builders/index";
import { EmbedType } from "lilybird";
import type { GuildTextChannel, Message } from "@lilybird/transformers";
import type { MessageCommand } from "@type/commands";
Expand Down
2 changes: 1 addition & 1 deletion src/commands-message/osu/banner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { client } from "@utils/initalize";
import { UserType } from "@type/commandArgs";
import { EmbedBuilderType } from "@type/embedBuilders";
import { Mode } from "@type/osu";
import { bannerBuilder } from "@builders/banner";
import { bannerBuilder } from "@builders/index";
import { EmbedType } from "lilybird";
import type { GuildTextChannel, Message } from "@lilybird/transformers";
import type { MessageCommand } from "@type/commands";
Expand Down
15 changes: 15 additions & 0 deletions src/commands/general/invite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { SlashCommand } from "@type/commands";

export default {
data: { name: "invite", description: "Get an invite link of the bot." },
run: async (interaction) => {
const links = {
invite: "https://discord.com/oauth2/authorize?client_id=995999045157916763&permissions=265216&scope=bot",
vote: "https://top.gg/bot/995999045157916763"
};

await interaction.editReply({
content: `You can invite the bot to your server using the following link:\n${links.invite}\nYou can also vote for the bot:\n${links.vote}`
});
}
} satisfies SlashCommand;
12 changes: 12 additions & 0 deletions src/commands/general/vote.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { SlashCommand } from "@type/commands";

export default {
data: { name: "vote", description: "Vote for the bot." },
run: async (interaction) => {
const voteLink = "https://top.gg/bot/995999045157916763";

await interaction.editReply({
content: `You can vote for the bot using the following link:\n${voteLink}`
});
}
} satisfies SlashCommand;
2 changes: 1 addition & 1 deletion src/commands/help/help.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { helpBuilder } from "@builders/help";
import { helpBuilder } from "@builders/index";
import type { SlashCommand } from "@type/commands";

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/osu/avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getCommandArgs } from "@utils/args";
import { client } from "@utils/initalize";
import { UserType } from "@type/commandArgs";
import { EmbedBuilderType } from "@type/embedBuilders";
import { avatarBuilder } from "@builders/avatar";
import { avatarBuilder } from "@builders/index";
import { ApplicationCommandOptionType, EmbedType } from "lilybird";
import type { ApplicationCommandData, GuildInteraction } from "@lilybird/transformers";
import type { SlashCommand } from "@type/commands";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/osu/background.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getCommandArgs } from "@utils/args";
import { getBeatmapIdFromContext } from "@utils/osu";
import { EmbedBuilderType } from "@type/embedBuilders";
import { backgroundBuilder } from "@builders/background";
import { backgroundBuilder } from "@builders/index";
import { client } from "@utils/initalize";
import { ApplicationCommandOptionType, EmbedType } from "lilybird";
import type { ApplicationCommandData, GuildInteraction } from "@lilybird/transformers";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/osu/banner.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { bannerBuilder } from "@builders/banner";
import { bannerBuilder } from "@builders/index";
import { getCommandArgs } from "@utils/args";
import { client } from "@utils/initalize";
import { UserType } from "@type/commandArgs";
Expand Down
7 changes: 7 additions & 0 deletions src/embed-builders/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
// Complicated functions
export * from "./compare";
export * from "./leaderboard";
export * from "./map";
export * from "./plays";
export * from "./profile";

// Simple functions
export * from "./simple/avatar";
export * from "./simple/background";
export * from "./simple/banner";
export * from "./simple/help";
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export function helpBuilder(): Array<EmbedStructure> {
const downloadedMaps = getRowCount("maps");
const hanamiWebsite = "https://hanami.yorunoken.com";
const inviteLink = "https://discord.com/oauth2/authorize?client_id=995999045157916763&permissions=265216&scope=bot";
const voteLink = "https://top.gg/bot/995999045157916763";

return [
{
Expand All @@ -17,7 +18,7 @@ export function helpBuilder(): Array<EmbedStructure> {
name: "Statistics",
value: `**Joined servers:** \`${joinedServers}\`\n**Users linked:** \`${linkedUers}\`\n**Maps in database:** ${downloadedMaps}`
},
{ name: "Links", value: `[Official Website](${hanamiWebsite}) | [Invite Link](${inviteLink})` }
{ name: "Links", value: `[Official Website](${hanamiWebsite}) | [Invite Link](${inviteLink}) | [Vote Link](${voteLink})` }
]
}
];
Expand Down
5 changes: 1 addition & 4 deletions src/listeners/interactionCreate.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { compareBuilder, leaderboardBuilder, mapBuilder, playBuilder, profileBuilder } from "../embed-builders";
import { getEntry, insertData } from "@utils/database";
import { client, applicationCommands, loadLogs } from "@utils/initalize";
import { mesageDataForButtons } from "@utils/cache";
import { EmbedBuilderType } from "@type/embedBuilders";
import { calculateButtonState, createActionRow } from "@utils/buttons";
import { backgroundBuilder } from "@builders/background";
import { avatarBuilder } from "@builders/avatar";
import { bannerBuilder } from "@builders/banner";
import { simulateBuilder } from "@builders/simulate";
import { Tables } from "@type/database";
import { compareBuilder, leaderboardBuilder, mapBuilder, playBuilder, profileBuilder, avatarBuilder, backgroundBuilder, bannerBuilder } from "@builders/index";
import type { DMInteraction, Interaction, InteractionReplyOptions, Message, MessageComponentData } from "@lilybird/transformers";
import type { EmbedStructure } from "lilybird";
import type { Event } from "@lilybird/handlers";
Expand Down

0 comments on commit 738d026

Please sign in to comment.