Jerimiah
Jerimiah
DIAdiscord.js - Imagine an app
Created by Jerimiah on 9/8/2024 in #djs-questions
Message to embed
I am trying to make a command that takes raw json as a message and converts it into an embed. I'm not sure how to get the parsed json object as an embed. If anyone could help that would be amazing.
const message = interaction.options.getString('json', true)

const json = JSON.parse(message)
const message = interaction.options.getString('json', true)

const json = JSON.parse(message)
4 replies
DIAdiscord.js - Imagine an app
Created by Jerimiah on 1/31/2023 in #djs-questions
Creating a class for events
Hello, I am trying to make a class for events. I have came up with the following, and it doesn't work I have provided my eslint errors below:
export default abstract class Event {
name: Events
run: any

constructor (name: Events) {
const event = name
this.name = event
this.run = (client: client, ...args: ClientEvents[event]) => any
}
}
export default abstract class Event {
name: Events
run: any

constructor (name: Events) {
const event = name
this.name = event
this.run = (client: client, ...args: ClientEvents[event]) => any
}
}
I want the class to inherit the parameters when given an event from the Events enum from the discord.js package. e.g:
messageCreate: [message: Message];

// ################

export default new Event(
Events.MessageCreate,
async (client, message: Message) {
// code here
}
}
messageCreate: [message: Message];

// ################

export default new Event(
Events.MessageCreate,
async (client, message: Message) {
// code here
}
}
The eslint errors that I am recieving:
// Type 'event' cannot be used as an index type. ts(2538)
// 'event' refers to a value, but is being used as a type here. Did you mean 'typeof event'? ts(2749)
// Type 'event' cannot be used as an index type. ts(2538)
// 'event' refers to a value, but is being used as a type here. Did you mean 'typeof event'? ts(2749)
11 replies
DIAdiscord.js - Imagine an app
Created by Jerimiah on 9/29/2022 in #djs-questions
Can buttons and action row be created as objects?
So I know you can create embeds using objects, I was wondering if the same could be done with action rows or buttons.
15 replies
DIAdiscord.js - Imagine an app
Created by Jerimiah on 7/22/2022 in #djs-questions
Bot Permissions Vs Intents
So on the developer portal there is a permission calculator and when given Administrator it gives you '8'. Now How does this compare to intents? Like could I put 8 as an intent and just go on with my day?
8 replies