Added random stuff
This commit is contained in:
44
src/commands/pp.ts
Normal file
44
src/commands/pp.ts
Normal 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
|
||||||
34
src/events/server/messages/eval.ts
Normal file
34
src/events/server/messages/eval.ts
Normal 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
|
||||||
Reference in New Issue
Block a user