-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
125 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-- AlterTable | ||
ALTER TABLE "User" ALTER COLUMN "levelCard" SET DEFAULT 'https://cdn.mikn.dev/bot-assets/mikanbot/default-lvlcard.png', | ||
ALTER COLUMN "rankColor" SET DEFAULT 'FF7700'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { | ||
type CommandInteraction, | ||
EmbedBuilder, | ||
ButtonBuilder, | ||
ActionRowBuilder, | ||
ButtonStyle, | ||
Colors, | ||
} from "discord.js"; | ||
import { PrismaClient } from "@prisma/client"; | ||
|
||
const prisma = new PrismaClient(); | ||
|
||
export default { | ||
name: "mikandev", | ||
description: "Manage your MikanDev account", | ||
cooldown: 0, | ||
isPremium: false, | ||
botPermissions: [], | ||
userPermissions: [], | ||
validations: [], | ||
slashCommand: { | ||
enabled: true, | ||
options: [], | ||
}, | ||
interactionRun: async (interaction: CommandInteraction) => { | ||
const userDb = await prisma.user.findUnique({ | ||
where: { | ||
id: interaction.user.id, | ||
}, | ||
}); | ||
const uid = userDb?.mdUID; | ||
|
||
if (uid === "unlinked") { | ||
const embed = new EmbedBuilder() | ||
.setTitle("MikanDev Account") | ||
.setDescription("You haven't linked your MikanDev account yet!") | ||
.setColor(Colors.Red); | ||
const button = new ButtonBuilder() | ||
.setStyle(ButtonStyle.Link) | ||
.setLabel("Link Account") | ||
.setURL( | ||
`https://mikn.dev/account/link?app=mikanbot&discord=${interaction.user.id}`, | ||
); | ||
|
||
const row = new ActionRowBuilder().addComponents(button); | ||
|
||
await interaction.reply({ | ||
embeds: [embed], | ||
components: [row], | ||
ephemeral: true, | ||
}); | ||
} | ||
if (uid !== "unlinked") { | ||
const embed = new EmbedBuilder() | ||
.setTitle("MikanDev Account") | ||
.setDescription( | ||
`You have linked your MikanDev account with UID: ${uid}`, | ||
) | ||
.setColor(Colors.Green); | ||
await interaction.reply({ embeds: [embed] }); | ||
} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters