Living Water
Living Water
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
@Favna @drainpixie Never mind. Sorry. I fixed it.
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
@drainpixie
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
import { Client, Collection, REST, Routes } from "discord.js";
import { Command } from "../types";
import { readdirSync } from 'node:fs';
import { token, guild, app } from "../config.json";

export default class extends Client {
public commands: Collection<string, Command> = new Collection();
public commandsArray: Command['structure'][] = [];

constructor() {
super({
intents: [
'Guilds'
]
});
};

public loadModules() {
// Commands
for (const dir of readdirSync('./dist/commands/')) {
for (const file of readdirSync('./dist/commands/' + dir)) {
const module: Command = require('../commands/' + dir + '/' + file).default;

this.commands.set(module.structure.name, module);
this.commandsArray.push(module.structure);

console.log('Loaded new command: ' + file);
};
};

// Events
for (const dir of readdirSync('./dist/events/')) {
for (const file of readdirSync('./dist/events/' + dir)) {
require('../events/' + dir + '/' + file);

console.log('Loaded new event: ' + file);
};
};
};

public command = class {
public structure: Command['structure'];
public run: Command['run'];

constructor(data: Command) {
this.structure = data.structure;
this.run = data.run;
};
};

public async deploy() {
const rest = new REST().setToken(token ?? '');

try {
console.log('Started loading app commands...');

await rest.put(Routes.applicationCommands(app ?? ''), {
body: this.commandsArray
});

console.log('Finished loading app commands.');
} catch (e) {
console.error(e);
};
};

public async start() {
await this.login(token);
};
};
import { Client, Collection, REST, Routes } from "discord.js";
import { Command } from "../types";
import { readdirSync } from 'node:fs';
import { token, guild, app } from "../config.json";

export default class extends Client {
public commands: Collection<string, Command> = new Collection();
public commandsArray: Command['structure'][] = [];

constructor() {
super({
intents: [
'Guilds'
]
});
};

public loadModules() {
// Commands
for (const dir of readdirSync('./dist/commands/')) {
for (const file of readdirSync('./dist/commands/' + dir)) {
const module: Command = require('../commands/' + dir + '/' + file).default;

this.commands.set(module.structure.name, module);
this.commandsArray.push(module.structure);

console.log('Loaded new command: ' + file);
};
};

// Events
for (const dir of readdirSync('./dist/events/')) {
for (const file of readdirSync('./dist/events/' + dir)) {
require('../events/' + dir + '/' + file);

console.log('Loaded new event: ' + file);
};
};
};

public command = class {
public structure: Command['structure'];
public run: Command['run'];

constructor(data: Command) {
this.structure = data.structure;
this.run = data.run;
};
};

public async deploy() {
const rest = new REST().setToken(token ?? '');

try {
console.log('Started loading app commands...');

await rest.put(Routes.applicationCommands(app ?? ''), {
body: this.commandsArray
});

console.log('Finished loading app commands.');
} catch (e) {
console.error(e);
};
};

public async start() {
await this.login(token);
};
};
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
No description
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
..... i dont know how
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
"and lastly the error Property 'parentId' does not exist on type 'TextBasedChannel'. is because you need to use interaction?.channel.isThread()"
this only gave me a new error
"The process.env.X errors are also correct, env vars can be undefined. You need to check that too."
i again want to clarify that i do not know how to fix the errors
"at the bottom where it says Cannot find name 'pmessage'. Did you mean 'message'? is because there is a typo"
changing that worked
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
@Favna So, how exactly do I fix the errors?
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
I had gotten thirty errors before; when I put the ? before the dots, almost half of the errors went away.
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
@Favna wait no that's not it
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
@Favna You'll need the code to properly debug, though. It can be found here: https://github.com/TFAGaming/DiscordTS-Template Thanks.
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
All right.
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
Right. I'm confused by "Uh as file" and also am confused by what time you will be eating breakfast.
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
Sorry, I'm confused.
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
?????
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
@Favna
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
One moment, please.
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
Thanks!
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
And I have no idea how to fix the errors.
35 replies
SIASapphire - Imagine a framework
Created by Living Water on 6/10/2023 in #discordjs-support
TypeScript ModMail
However, there is this one very small YouTuber who showed his TypeScript code for a ModMail bot, but I got 18 errors in 8 files!
35 replies