Skip to content

Commit 9bd91c7

Browse files
author
Jacob Fear
committed
Version 0.0.2
1 parent 52af7ae commit 9bd91c7

18 files changed

+78
-385
lines changed

DscCommands/deploy.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

DscCommands/dis-reload.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

DscCommands/eval.js

Lines changed: 0 additions & 52 deletions
This file was deleted.

DscCommands/help.js

Lines changed: 0 additions & 69 deletions
This file was deleted.

DscCommands/mylevel.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

DscCommands/reboot.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

DscCommands/stats.js

Lines changed: 0 additions & 31 deletions
This file was deleted.

DscEvents/interactionCreate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = async (client, interaction) => {
2929
// This will basically set the ephemeral response to either announce
3030
// to everyone, or just the command executioner. But we **HAVE** to
3131
// respond.
32-
ephemeral: settings.systemNotice !== "true"
32+
ephemeral: "true"
3333
});
3434
}
3535

DscEvents/messageCreate.js

Lines changed: 2 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,17 @@ module.exports = async (client, message) => {
1616
if (message.author.bot) return;
1717
if (message.webhookId) return;
1818

19-
// Grab the settings for this server from Enmap.
20-
// If there is no guild, get default conf (DMs)
21-
const settings = config.defaultSettings;
19+
2220

2321
// Checks if the bot was mentioned via regex, with no message after it,
2422
// returns the prefix. The reason why we used regex here instead of
2523
// message.mentions is because of the mention prefix later on in the
2624
// code, would render it useless.
2725
const prefixMention = new RegExp(`^<@!?${client.user.id}> ?$`);
2826
if (message.content.match(prefixMention)) {
29-
return message.reply(`My prefix on this guild is \`${settings.prefix}\``);
27+
return message.reply(`This bot's commands can be used by slash commands`);
3028
}
3129

32-
// It's also good practice to ignore any and all messages that do not start
33-
// with our prefix, or a bot mention.
34-
const prefix = new RegExp(`^<@!?${client.user.id}> |^\\${settings.prefix}`).exec(message.content);
35-
// If it's not a command, treat it as a relay if it matches our relay channel.
36-
if (!prefix){
37-
// If it is a relay channel for Main
3830

3931
config.relays.forEach (async (value, key) => {
4032
if (value === message.channel.id) {
@@ -50,66 +42,4 @@ module.exports = async (client, message) => {
5042
}
5143

5244
})
53-
54-
55-
56-
57-
58-
}else{
59-
// Here we separate our "command" name, and our "arguments" for the command.
60-
// e.g. if we have the message "+say Is this the real life?" , we'll get the following:
61-
// command = say
62-
// args = ["Is", "this", "the", "real", "life?"]
63-
const args = message.content.slice(prefix[0].length).trim().split(/ +/g);
64-
const command = args.shift().toLowerCase();
65-
66-
// If the member on a guild is invisible or not cached, fetch them.
67-
if (message.guild && !message.member) await message.guild.members.fetch(message.author);
68-
69-
// Get the user or member's permission level from the elevation
70-
const level = permlevel(message);
71-
72-
// Check whether the command, or alias, exist in the collections defined
73-
// in app.js.
74-
const cmd = container.commands.get(command) || container.commands.get(container.aliases.get(command));
75-
// using this const varName = thing OR otherThing; is a pretty efficient
76-
// and clean way to grab one of 2 values!
77-
if (!cmd) return;
78-
79-
// Some commands may not be useable in DMs. This check prevents those commands from running
80-
// and return a friendly error message.
81-
if (cmd && !message.guild && cmd.conf.guildOnly)
82-
return message.channel.send("This command is unavailable via private message. Please run this command in a guild.");
83-
84-
if (!cmd.conf.enabled) return;
85-
86-
if (level < container.levelCache[cmd.conf.permLevel]) {
87-
if (settings.systemNotice === "true") {
88-
return message.channel.send(`You do not have permission to use this command.
89-
Your permission level is ${level} (${config.permLevels.find(l => l.level === level).name})
90-
This command requires level ${container.levelCache[cmd.conf.permLevel]} (${cmd.conf.permLevel})`);
91-
} else {
92-
return;
93-
}
94-
}
95-
96-
// To simplify message arguments, the author's level is now put on level (not member so it is supported in DMs)
97-
// The "level" command module argument will be deprecated in the future.
98-
message.author.permLevel = level;
99-
100-
message.flags = [];
101-
while (args[0] && args[0][0] === "-") {
102-
message.flags.push(args.shift().slice(1));
103-
}
104-
// If the command exists, **AND** the user has permission, run it.
105-
try {
106-
await cmd.run(client, message, args, level);
107-
logger.log(`${config.permLevels.find(l => l.level === level).name} ${message.author.id} ran command ${cmd.help.name}`, "cmd");
108-
} catch (e) {
109-
console.error(e);
110-
message.channel.send({ content: `There was a problem with your request.\n\`\`\`${e.message}\`\`\`` })
111-
.catch(e => console.error("An error occurred replying on an error", e));
112-
}
113-
114-
}
11545
};

DscEvents/ready.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ module.exports = async client => {
44
logger.log(`${client.user.tag}, ready to serve ${client.guilds.cache.map(g => g.memberCount).reduce((a, b) => a + b)} users in ${client.guilds.cache.size} servers.`, "ready");
55

66
// Make the bot "play the game" which is the help command with default prefix.
7-
client.user.setActivity(`Tagteaming SL and Discord`, { type: "PLAYING" });
7+
client.user.setActivity(`with the Metaverse`, { type: "PLAYING" });
88
};

0 commit comments

Comments
 (0)