Skip to content

Commit 01bd29e

Browse files
committed
1.1.0
1 parent fe1c4ca commit 01bd29e

File tree

11 files changed

+104
-276
lines changed

11 files changed

+104
-276
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,4 @@ dist
101101
.dynamodb/
102102

103103
# TernJS port file
104-
.tern-port
104+
.tern-port

Data/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"token": "TOKEN",
3-
"embedcolor": "#FFFFFF"
2+
"token": "ODg4NjY5NTg4MzQxMDI2ODI2.YUWEDA.H8kdhhvXnI7aiKfgf-ZABPp7yX8",
3+
"prefix": "!"
44
}

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,12 @@
22

33
It is a simple event and command handler for Discord.js V13.
44

5-
Credits to
5+
6+
| Version | Command Handler | Event Handler | Custom Server Prefix | Download |
7+
|-|-|-|-|
8+
| 1.0.0 |||| [![Download](https://img.shields.io/badge/Download-v1.0.0-blue?style=flat-square)](https://github.com/MastiderMast/Discord.js-Advanced-Command-Handler/releases/tag/1.0.0) |
9+
| 1.1.0 |||| Not Yet |
10+
11+
12+
###### Credits
13+
[I used his good code as a basis](https://github.com/Ferotiq/Discord.JS-13-Tutorial).

commands/explain.js renamed to commands/hello.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
const Command = require("../Structures/Command.js");
2-
const Discord = require("discord.js");
32
const Event = require("../Structures/Event.js");
4-
const { version } = require('../package.json');
3+
const Discord = require("discord.js");
54
const config = require("../Data/config.json");
65
const { MessageSelectMenu, MessageActionRow, MessageButton } = require("discord.js");
76
const { red, green, blue, yellow, cyan, greenBright, redBright, grey, yellowBright, cyanBright, black, blueBright } = require('chalk');
8-
const core = require('@hazo-development/hazo-core');
7+
const { version } = require('../package.json');
98

109
module.exports = new Command({
11-
name: "explain",
10+
name: "hello",
1211
description: "Hello world.",
13-
aliases: ["hello world"],
12+
aliases: ["hey", "hi"],
1413

15-
async run(message, args, con, rows, client) {
14+
async run(message, args, client) {
1615
try {
1716
message.reply("Hello world!");
1817
} catch (error) {

events/interactionCreate.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
const Command = require("../Structures/Command.js");
2-
const Discord = require("discord.js");
32
const Event = require("../Structures/Event.js");
4-
const { version } = require('../package.json');
3+
const Discord = require("discord.js");
54
const config = require("../Data/config.json");
65
const { MessageSelectMenu, MessageActionRow, MessageButton } = require("discord.js");
76
const { red, green, blue, yellow, cyan, greenBright, redBright, grey, yellowBright, cyanBright, black, blueBright } = require('chalk');
8-
const core = require('@hazo-development/hazo-core');
7+
const { version } = require('../package.json');
98

109
module.exports = new Event("interactionCreate", (client, interaction) => {
11-
10+
try {
11+
//YOUR CODE
12+
} catch (error) {
13+
return console.log(red(`[EVENT] In the event interactionCreate an error has occurred -> ${error}`))
14+
}
1215
});

events/messageCreate.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
const Command = require("../Structures/Command.js");
2-
const Discord = require("discord.js");
32
const Event = require("../Structures/Event.js");
4-
const mysql = require('mysql');
5-
const { version } = require('../package.json');
3+
const Discord = require("discord.js");
64
const config = require("../Data/config.json");
75
const { MessageSelectMenu, MessageActionRow, MessageButton } = require("discord.js");
86
const { red, green, blue, yellow, cyan, greenBright, redBright, grey, yellowBright, cyanBright, black, blueBright } = require('chalk');
9-
const core = require('@hazo-development/hazo-core');
7+
const { version } = require('../package.json');
108

11-
var con = mysql.createConnection({multipleStatements: true,
12-
host: "IP",
13-
user: "USER",
14-
password: "PASSWORD",
15-
database: "DATABASE"
16-
});
9+
let prefix = config.prefix
1710

1811
module.exports = new Event("messageCreate", async (client, message) => {
12+
try {
13+
if (message.author.bot) return;
1914

15+
if (message.content.startsWith(prefix)) {
16+
17+
const args = message.content.substring(prefix.length).split(/ +/);
18+
const command = client.commands.find(cmd => cmd.name == args[0] || cmd.aliases.includes(args[0]));
19+
if (!command) return message.reply(`${args[0]} is not a valid command!`);
20+
command.run(message, args, client)
21+
}
22+
} catch (error) {
23+
return console.log(red(`[EVENT] In the event messageCreate an error has occurred -> ${error}`))
24+
}
2025
});

events/ready.js

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,31 @@
11
const Command = require("../Structures/Command.js");
2-
const Discord = require("discord.js");
32
const Event = require("../Structures/Event.js");
4-
const { version } = require('../package.json');
3+
const Discord = require("discord.js");
54
const config = require("../Data/config.json");
65
const { MessageSelectMenu, MessageActionRow, MessageButton } = require("discord.js");
76
const { red, green, blue, yellow, cyan, greenBright, redBright, grey, yellowBright, cyanBright, black, blueBright } = require('chalk');
8-
const core = require('@hazo-development/hazo-core');
7+
const { version } = require('../package.json');
98

109
module.exports = new Event("ready", client => {
10+
try {
11+
console.log(yellow(`[LOGIN] logged in as ${client.user.tag} -> Version ${version}`))
12+
13+
//ACTIVITY
14+
let status_state = 0;
15+
client.user.setActivity('you', { type: 'WATCHING' });
16+
setInterval(() => {
17+
let status_presences = [
18+
{ type: 'PLAYING', message: 'Version: '+ version},
19+
{ type: 'WATCHING', message: `${client.guilds.cache.size} server.`},
20+
{ type: 'WATCHING', message: `${client.users.cache.size} user.`},
21+
{ type: 'WATCHING', message: `${client.commands.size} commands.`}
22+
];
23+
status_state = (status_state + 1) % status_presences.length;
24+
status_presence = status_presences[status_state];
25+
client.user.setActivity(status_presence.message, { type: status_presence.type });
26+
}, 5000);
1127

12-
console.log(yellow(`Angemeldet als '${client.user.tag}'! Version -> ` + version))
13-
14-
const startup = new Discord.MessageEmbed()
15-
startup.setTitle(`${client.user.username} | Log`)
16-
startup.setDescription(Date())
17-
startup.setColor(`${config.embedcolor}`)
18-
startup.addField(`Version`, `${version}`)
19-
startup.setThumbnail(client.user.avatarURL())
20-
startup.setTimestamp()
21-
startup.setFooter(`${client.user.username}`, client.user.avatarURL());
22-
client.channels.cache.get("885142818950111242").send({embeds: [startup]});
23-
24-
//ACTIVITY
25-
let status_state = 0;
26-
client.user.setActivity('you', { type: 'WATCHING' });
27-
setInterval(() => {
28-
let status_presences = [
29-
{ type: 'PLAYING', message: 'Version: '+version},
30-
{ type: 'WATCHING', message: `${client.guilds.cache.size} server.`},
31-
{ type: 'WATCHING', message: `${client.users.cache.size} user.`},
32-
{ type: 'WATCHING', message: `${client.commands.size} commands.`}
33-
];
34-
status_state = (status_state + 1) % status_presences.length;
35-
status_presence = status_presences[status_state];
36-
client.user.setActivity(status_presence.message, { type: status_presence.type });
37-
}, 5000);
38-
28+
} catch (error) {
29+
return console.log(red(`[EVENT] In the event ready an error has occurred -> ${error}`))
30+
}
3931
});

0 commit comments

Comments
 (0)