Added random stuff

This commit is contained in:
2024-01-17 21:16:55 +01:00
parent c50c3759c8
commit 9d44ca8d6d
2 changed files with 78 additions and 0 deletions

44
src/commands/pp.ts Normal file
View File

@@ -0,0 +1,44 @@
import { SlashCommandBuilder, User } from "discord.js"
import { color } from "config/options.json"
import { Command } from "interfaces"
import env from "utils/Env"
export = {
name: "pp",
description: "Shows pp size",
type: "slash",
public: true,
dev: true,
data: new SlashCommandBuilder()
.setName("pp")
.setDescription("Shows pp size")
.addUserOption(
option =>
option
.setName("user")
.setDescription("User to show pp size")
.setRequired(false)
)
.setDMPermission(false),
async execute(interaction) {
const user = (interaction.options.getUser("user") || interaction.user) as User
const embedColor = Number(color.replace("#", "0x"))
let size: number
if (user.id === env.prod.dev) {
size = Math.floor(Math.random() * 30) + 1
} else {
size = Math.floor(Math.random() * 10) + 1
}
await interaction.reply({
embeds: [{
title: `${user.username}'s pp size`,
description: `8${"=".repeat(size)}D`,
color: embedColor
}]
})
}
} as Command

View File

@@ -0,0 +1,34 @@
import { Message } from "discord.js"
import { Event } from "interfaces"
import env from "utils/Env"
export = {
name: "eval",
description: "Evaluate a JavaScript expression",
type: "event",
event: "messageCreate",
async execute(message: Message) {
if (message.author.bot) return
if (message.author.id !== env.prod.dev) return
if (!message.content.startsWith("!eval")) return
const code = message.content.split(" ").slice(1).join(" ")
try {
const output = eval(code)
const outputString = String(output)
await message.channel.send({
embeds: [{
description: `\`\`\`js\n${outputString}\`\`\``
}]
})
} catch (error) {
await message.channel.send({
embeds: [{
description: `\`\`\`js\n${error}\`\`\``
}]
})
}
}
} as Event