mirror of
https://github.com/danbulant/Shasha
synced 2026-06-19 14:21:37 +00:00
fix
This commit is contained in:
parent
b40b2857d2
commit
2e28c90c9e
8 changed files with 93 additions and 56 deletions
|
|
@ -17,12 +17,8 @@ module.exports = class chat extends commando.Command {
|
|||
if (!args) {
|
||||
return trySend(msg.client, msg, "Ask me somethin?");
|
||||
}
|
||||
return msg.channel.startTyping()
|
||||
.then(
|
||||
trySend(this.client, msg, await chatAnswer(
|
||||
msg.cleanContent.slice((msg.guild.commandPrefix + msg.command.name).length).trim()
|
||||
)).then(r => r)
|
||||
).catch(() => { })
|
||||
.finally(msg.channel.stopTyping());
|
||||
msg.channel.startTyping();
|
||||
return trySend(this.client, msg, await chatAnswer(
|
||||
msg.cleanContent.slice((msg.guild.commandPrefix + msg.command.name).length).trim()));
|
||||
}
|
||||
};
|
||||
28
cmds/fun/f.js
Normal file
28
cmds/fun/f.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
const commando = require("@iceprod/discord.js-commando");
|
||||
const { trySend } = require("../../resources/functions");
|
||||
|
||||
module.exports = class f extends commando.Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "f",
|
||||
memberName: "f",
|
||||
group: "fun",
|
||||
description: "description"
|
||||
});
|
||||
}
|
||||
async run(msg, arg) {
|
||||
if (!msg.author.dbLoaded) await msg.author.dbLoad();
|
||||
if (arg) {
|
||||
msg.author.F = arg;
|
||||
await msg.author.setF(arg)
|
||||
};
|
||||
return trySend(msg.client, msg,
|
||||
msg.author.F + msg.author.F + msg.author.F + "\n" +
|
||||
msg.author.F + "\n" +
|
||||
msg.author.F + msg.author.F + msg.author.F + "\n" +
|
||||
msg.author.F + "\n" +
|
||||
msg.author.F);
|
||||
}
|
||||
};
|
||||
|
|
@ -21,7 +21,7 @@ module.exports = class eventlog extends commando.Command {
|
|||
let eventChannels = msg.guild.eventChannels;
|
||||
if (set.length < 2 && set[0].length === 0) return trySend(this.client, msg, await resultEmbed(this));
|
||||
let report = "", joinlog, leavelog, channellog, banlog, unbanlog, mesEdlog = { channel: undefined, ignore: [] }, invitelog, rolelog,
|
||||
guildlog, membernicklog, emotelog, memberroleslog, remove = false, [setMesEdIgnore, setMesDelIgnore] = [false, false], mesDellog = { channel: undefined, ignore: [] };
|
||||
guildlog, membernicklog, emotelog, memberroleslog, remove = false, [setMesEdIgnore, setMesDelIgnore] = [false, false], mesDellog = { channel: undefined, ignore: [] };
|
||||
for (const args of set) {
|
||||
if (args.startsWith("r ")) remove = true;
|
||||
if (args.startsWith("j ")) {
|
||||
|
|
@ -84,7 +84,7 @@ module.exports = class eventlog extends commando.Command {
|
|||
if (chan) {
|
||||
if (mesEdlog.ignore.includes(chan.id)) {
|
||||
report += "**[MESEDIT_CHANNELIGNORE]** Duplicate result: <#" + chan.id +
|
||||
`> with keyword: **${ign.trim()}**\n`;
|
||||
`> with keyword: **${ign.trim()}**\n`;
|
||||
} else {
|
||||
mesEdlog.ignore.push(chan.id);
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ module.exports = class eventlog extends commando.Command {
|
|||
if (chan) {
|
||||
if (mesDellog.ignore.includes(chan.id)) {
|
||||
report += "**[MESDEL_CHANNELIGNORE]** Duplicate result: <#" + chan.id +
|
||||
`> with keyword: **${ign.trim()}**\n`;
|
||||
`> with keyword: **${ign.trim()}**\n`;
|
||||
} else {
|
||||
mesDellog.ignore.push(chan.id);
|
||||
}
|
||||
|
|
@ -217,24 +217,24 @@ module.exports = class eventlog extends commando.Command {
|
|||
async function resultEmbed(the) {
|
||||
const emb = defaultImageEmbed(msg, null, "Event Log Channels Configuration");
|
||||
emb
|
||||
.setDescription(`Set configuration using \`\`\`js\n${msg.guild.commandPrefix + the.name} [--remove] --<Category> <Channel_[Mention | Name | ID]>\`\`\`**Categories:** \`\`\`js\n[MESSAGE [-ignore <Channel_[Mention | Name | ID]>], JOINLEAVE, MEMBER, MEMBERROLE, BANUNBAN, GUILD, ROLE, CHANNEL, EMOJI, INVITE]\`\`\``)
|
||||
.addField(`Message Edit`, eventChannels?.mesEd?.channel ? `<#${eventChannels?.mesEd.channel}>\n**Ignores:** ${eventChannels?.mesEd?.ignore?.length > 0 ?
|
||||
"<#" + eventChannels?.mesEd.ignore.join(">, <#") + ">" : "None"}`
|
||||
: "Not set", true)
|
||||
.addField(`Message Delete`, eventChannels?.mesDel?.channel ? `<#${eventChannels?.mesDel.channel}>\n**Ignores:** ${eventChannels?.mesDel?.ignore?.length > 0 ?
|
||||
"<#" + eventChannels?.mesDel.ignore.join(">, <#") + ">" : "None"}`
|
||||
: "Not set", true)
|
||||
.addField(`Member Join`, eventChannels?.join ? `<#${eventChannels.join}>` : "Not set", true)
|
||||
.addField(`Member Leave`, eventChannels?.leave ? `<#${eventChannels.leave}>` : "Not set", true)
|
||||
.addField(`Member Profile Updates`, eventChannels?.member ? `<#${eventChannels?.member}>` : "Not set", true)
|
||||
.addField(`Member Role Updates`, eventChannels?.memberRole ? `<#${eventChannels?.memberRole}>` : "Not set", true)
|
||||
.addField(`Member Ban`, eventChannels?.ban ? `<#${eventChannels?.ban}>` : "Not set", true)
|
||||
.addField(`Member Unban`, eventChannels?.unban ? `<#${eventChannels?.unban}>` : "Not set", true)
|
||||
.addField(`Server Updates`, eventChannels?.guild ? `<#${eventChannels?.guild}>` : "Not set", true)
|
||||
.addField(`Server Role Updates`, eventChannels?.role ? `<#${eventChannels?.role}>` : "Not set", true)
|
||||
.addField(`Server Channels Updates`, eventChannels?.channel ? `<#${eventChannels?.channel}>` : "Not set", true)
|
||||
.addField(`Server Emoji Updates`, eventChannels?.emote ? `<#${eventChannels?.emote}>` : "Not set", true)
|
||||
.addField(`Server Invites`, eventChannels?.invite ? `<#${eventChannels?.invite}>` : "Not set", true);
|
||||
.setDescription(`Set configuration using \`\`\`js\n${msg.guild.commandPrefix + the.name} [--remove] --<Category> <Channel_[Mention | Name | ID]>\`\`\`**Categories:** \`\`\`js\n[MESSAGE[EDIT, DELETE]: --[e, d] [IGNORE: -i <Channel_[Mention | Name | ID]>], JOIN: --j, LEAVE: --l, MEMBER: --p, MEMBERROLE: --mr, BAN: --b, UNBAN: --u, GUILD: --g, ROLE: --r, CHANNEL: --c, EMOJI: --em, INVITE: --i]\`\`\``)
|
||||
.addField(`Message Edit`, eventChannels?.mesEd?.channel ? `<#${eventChannels?.mesEd.channel}>\n**Ignores:** ${eventChannels?.mesEd?.ignore?.length > 0 ?
|
||||
"<#" + eventChannels?.mesEd.ignore.join(">, <#") + ">" : "None"}`
|
||||
: "Not set", true)
|
||||
.addField(`Message Delete`, eventChannels?.mesDel?.channel ? `<#${eventChannels?.mesDel.channel}>\n**Ignores:** ${eventChannels?.mesDel?.ignore?.length > 0 ?
|
||||
"<#" + eventChannels?.mesDel.ignore.join(">, <#") + ">" : "None"}`
|
||||
: "Not set", true)
|
||||
.addField(`Member Join`, eventChannels?.join ? `<#${eventChannels.join}>` : "Not set", true)
|
||||
.addField(`Member Leave`, eventChannels?.leave ? `<#${eventChannels.leave}>` : "Not set", true)
|
||||
.addField(`Member Profile Updates`, eventChannels?.member ? `<#${eventChannels?.member}>` : "Not set", true)
|
||||
.addField(`Member Role Updates`, eventChannels?.memberRole ? `<#${eventChannels?.memberRole}>` : "Not set", true)
|
||||
.addField(`Member Ban`, eventChannels?.ban ? `<#${eventChannels?.ban}>` : "Not set", true)
|
||||
.addField(`Member Unban`, eventChannels?.unban ? `<#${eventChannels?.unban}>` : "Not set", true)
|
||||
.addField(`Server Updates`, eventChannels?.guild ? `<#${eventChannels?.guild}>` : "Not set", true)
|
||||
.addField(`Server Role Updates`, eventChannels?.role ? `<#${eventChannels?.role}>` : "Not set", true)
|
||||
.addField(`Server Channels Updates`, eventChannels?.channel ? `<#${eventChannels?.channel}>` : "Not set", true)
|
||||
.addField(`Server Emoji Updates`, eventChannels?.emote ? `<#${eventChannels?.emote}>` : "Not set", true)
|
||||
.addField(`Server Invites`, eventChannels?.invite ? `<#${eventChannels?.invite}>` : "Not set", true);
|
||||
return emb;
|
||||
}
|
||||
eventChannels = {
|
||||
|
|
|
|||
|
|
@ -18,10 +18,14 @@ module.exports = class UnknownCommandCommand extends Command {
|
|||
// eslint-disable-next-line
|
||||
async run(msg) {
|
||||
if (/^<@\!?\d{17,19}>\s.+/.test(msg.content)) {
|
||||
msg.channel.startTyping();
|
||||
const s = msg.cleanContent.slice((msg.guild ? msg.guild.member(msg.client.user).displayName.length : msg.client.user.username.length) + 2).trim();
|
||||
return msg.channel.startTyping().then(trySend(msg.client, msg, await chatAnswer(s)).then(r => r)).catch(() => { }).finally(msg.channel.stopTyping());
|
||||
return trySend(msg.client, msg, await chatAnswer(s));
|
||||
}
|
||||
if (!msg.guild && !msg.content.toLowerCase().startsWith(msg.client.commandPrefix)) return msg.channel.startTyping().then(trySend(msg.client, msg, await chatAnswer(msg.cleanContent)).then(r => r)).catch(() => { }).finally(msg.channel.stopTyping());
|
||||
if (!msg.guild && !msg.content.toLowerCase().startsWith(msg.client.commandPrefix)) {
|
||||
msg.channel.startTyping();
|
||||
return trySend(msg.client, msg, await chatAnswer(msg.cleanContent));
|
||||
};
|
||||
try {
|
||||
return await msg.channel.send(
|
||||
`Unknown command \`${msg.content}\`. Use ${msg.anyUsage(
|
||||
|
|
|
|||
|
|
@ -23,9 +23,8 @@ function giveNickHeart(msg) {
|
|||
|
||||
async function letsChat(msg) {
|
||||
if (msg.channel.id === configFile.chatChannel && !msg.author.bot && !msg.isCommand && msg.cleanContent.length > 0) {
|
||||
return msg.channel.startTyping().then(trySend(msg.client, msg, await chatAnswer(msg.cleanContent)).then(r => r)
|
||||
).catch(() => { })
|
||||
.finally(msg.channel.stopTyping());
|
||||
msg.channel.startTyping();
|
||||
return trySend(msg.client, msg, await chatAnswer(msg.cleanContent));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ const getColor = require("../getColor");
|
|||
*/
|
||||
module.exports = async (msg) => {
|
||||
if (msg.partial) return;
|
||||
const ignored = msg.guild.eventChannels.mesDel.ignore?.includes(msg.channel.id) ?? false;
|
||||
const ignored = msg.guild.eventChannels.mesDel?.ignore?.includes(msg.channel.id) ?? false;
|
||||
let check = false;
|
||||
if (msg.channel.id === msg.guild.eventChannels?.mesDel?.channel && msg.author ? msg.author !== msg.client.user : false && ignored === false) check = true;
|
||||
if (msg.guild.eventChannels?.mesDel?.channel !== msg.channel.id && ignored === false || check) {
|
||||
|
|
@ -19,19 +19,19 @@ module.exports = async (msg) => {
|
|||
if (!log || !msg.author) return;
|
||||
const emb = defaultEventLogEmbed(msg.guild);
|
||||
emb.setColor(getColor("yellow"))
|
||||
.setTitle((!msg.webhookID ? "Message " + msg.id : "Webhook " + msg.webhookID) + " deleted")
|
||||
.setDescription(msg.content.length > 0 ? msg.content : "`[EMPTY]`")
|
||||
.setAuthor(emb.author.name, msg.author?.displayAvatarURL({format: "png", size: 128, dynamic: true}))
|
||||
.addField("Author", `<@!${msg.author?.id}>\n\`${msg.author?.tag}\`\n(${msg.author?.id})`,true)
|
||||
.addField("Channel", `<#${msg.channel?.id}>\n\`${msg.channel?.name}\`\n(${msg.channel?.id})`,true)
|
||||
.setURL(msg.url);
|
||||
.setTitle((!msg.webhookID ? "Message " + msg.id : "Webhook " + msg.webhookID) + " deleted")
|
||||
.setDescription(msg.content.length > 0 ? msg.content : "`[EMPTY]`")
|
||||
.setAuthor(emb.author.name, msg.author?.displayAvatarURL({ format: "png", size: 128, dynamic: true }))
|
||||
.addField("Author", `<@!${msg.author?.id}>\n\`${msg.author?.tag}\`\n(${msg.author?.id})`, true)
|
||||
.addField("Channel", `<#${msg.channel?.id}>\n\`${msg.channel?.name}\`\n(${msg.channel?.id})`, true)
|
||||
.setURL(msg.url);
|
||||
if (msg.attachments?.size > 0) {
|
||||
let arr = msg.attachments.map(r => r.proxyURL);
|
||||
const toField = splitOnLength(arr, 1024);
|
||||
for (const add of toField) emb.addField(emb.fields.length === 2 ? "Attachment" : "", add.join("\n"));
|
||||
}
|
||||
if (msg.embeds?.[0]) {
|
||||
const arr = JSON.stringify(msg.embeds[0], (k, v) => v ?? undefined, 2).replace(/```/g,"`\\``").split(",");
|
||||
const arr = JSON.stringify(msg.embeds[0], (k, v) => v ?? undefined, 2).replace(/```/g, "`\\``").split(",");
|
||||
const toField = splitOnLength(arr, 1010, ",\n");
|
||||
for (let i = 0; i < toField.length; i++) emb.addField(i === 0 ? "Embed" : "", "```js\n" + toField[i].join(",") + ((i !== toField.length - 1) ? "," : "") + "```");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ module.exports = async (msgold, msgnew) => {
|
|||
let check = false;
|
||||
if (msgnew.channel.id === msgnew.guild.eventChannels?.mesEd?.channel && msgnew.author ? msgnew.author !== msgnew.client.user : false && ignored === false) check = true;
|
||||
if (msgnew.guild.eventChannels?.mesEd?.channel !== msgnew.channel.id && ignored === false || check) {
|
||||
const log = getChannel(msgnew, msgnew.guild.eventChannels.mesEd.channel);
|
||||
const log = getChannel(msgnew, msgnew.guild.eventChannels.mesEd?.channel);
|
||||
if (!log || !msgnew.author) return;
|
||||
const emb = defaultEventLogEmbed(msgnew.guild);
|
||||
emb
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
const { Structures } = require("discord.js"),
|
||||
{ database } = require("../database/mongo"),
|
||||
{ errLog } = require("./functions");
|
||||
{ database } = require("../database/mongo"),
|
||||
{ errLog } = require("./functions");
|
||||
|
||||
Structures.extend("Guild", g => {
|
||||
return class Guild extends g {
|
||||
|
|
@ -12,7 +12,7 @@ Structures.extend("Guild", g => {
|
|||
}
|
||||
|
||||
async dbLoad() {
|
||||
return database.collection("Guild").findOne({document: this.id}).then((r, j) => {
|
||||
return database.collection("Guild").findOne({ document: this.id }).then((r, j) => {
|
||||
if (j) return errLog(j, null, this.client);
|
||||
this.infractions = r?.moderation?.infractions || [];
|
||||
this.moderation = r?.moderation?.settings || {};
|
||||
|
|
@ -49,7 +49,7 @@ Structures.extend("Guild", g => {
|
|||
}
|
||||
|
||||
async setDescription(set) {
|
||||
return database.collection("Guild").updateOne({document: this.id}, { $set: { description: set }, $setOnInsert: { document: this.id }}, {upsert: true}, (e, r) => {
|
||||
return database.collection("Guild").updateOne({ document: this.id }, { $set: { description: set }, $setOnInsert: { document: this.id } }, { upsert: true }, (e, r) => {
|
||||
if (e) return errLog(e, null, this.client);
|
||||
this.description = set;
|
||||
return true;
|
||||
|
|
@ -60,7 +60,7 @@ Structures.extend("Guild", g => {
|
|||
try {
|
||||
const r = await database.collection("Guild").findOne({ document: this.id });
|
||||
this.infractions = r?.moderation?.infractions;
|
||||
return database.collection("Guild").updateOne({document: this.id}, {$push:{"moderation.infractions":add}}, (e) => {
|
||||
return database.collection("Guild").updateOne({ document: this.id }, { $push: { "moderation.infractions": add } }, (e) => {
|
||||
if (e) return errLog(e, null, this.client);
|
||||
this.infractions.push(add);
|
||||
return true;
|
||||
|
|
@ -69,7 +69,7 @@ Structures.extend("Guild", g => {
|
|||
}
|
||||
|
||||
async setQuoteOTD(set) {
|
||||
return database.collection("Guild").updateOne({document: this.id}, {$set: {"settings.quoteOTD": set}, $setOnInsert: { document: this.id }}, {upsert: true}, (e) => {
|
||||
return database.collection("Guild").updateOne({ document: this.id }, { $set: { "settings.quoteOTD": set }, $setOnInsert: { document: this.id } }, { upsert: true }, (e) => {
|
||||
if (e) return errLog(e, null, this.client);
|
||||
this.quoteOTD = set;
|
||||
return true;
|
||||
|
|
@ -77,7 +77,7 @@ Structures.extend("Guild", g => {
|
|||
}
|
||||
|
||||
async setEventChannels(set) {
|
||||
return database.collection("Guild").updateOne({document: this.id}, {$set: {"settings.eventChannels": set}, $setOnInsert: { document: this.id }}, {upsert: true}, (e) => {
|
||||
return database.collection("Guild").updateOne({ document: this.id }, { $set: { "settings.eventChannels": set }, $setOnInsert: { document: this.id } }, { upsert: true }, (e) => {
|
||||
if (e) return errLog(e, null, this.client);
|
||||
this.eventChannels = set;
|
||||
return true;
|
||||
|
|
@ -85,7 +85,7 @@ Structures.extend("Guild", g => {
|
|||
}
|
||||
|
||||
async setDefaultEmbed(set) {
|
||||
return database.collection("Guild").updateOne({document: this.id}, {$set:{"settings.defaultEmbed": set}, $setOnInsert: { document: this.id }}, {upsert: true}, (e) => {
|
||||
return database.collection("Guild").updateOne({ document: this.id }, { $set: { "settings.defaultEmbed": set }, $setOnInsert: { document: this.id } }, { upsert: true }, (e) => {
|
||||
if (e) return errLog(e, null, this.client);
|
||||
this.defaultEmbed = set;
|
||||
return true;
|
||||
|
|
@ -93,7 +93,7 @@ Structures.extend("Guild", g => {
|
|||
}
|
||||
|
||||
async setModerationSettings(set) {
|
||||
return database.collection("Guild").updateOne({document:this.id}, {$set:{"moderation.settings": set}, $setOnInsert: { document: this.id }}, {upsert: true}, (e) => {
|
||||
return database.collection("Guild").updateOne({ document: this.id }, { $set: { "moderation.settings": set }, $setOnInsert: { document: this.id } }, { upsert: true }, (e) => {
|
||||
if (e) return errLog(e, null, this.client);
|
||||
this.moderation = set;
|
||||
return true;
|
||||
|
|
@ -108,21 +108,31 @@ Structures.extend("User", u => {
|
|||
super(client, data);
|
||||
this.dbLoaded = false;
|
||||
this.cutie = true;
|
||||
this.F = "F";
|
||||
}
|
||||
|
||||
async setF(string) {
|
||||
return database.collection("User").updateOne({ document: this.id }, { $set: { F: string }, $setOnInsert: { document: this.id } }, { upsert: true }, (e, r) => {
|
||||
if (e) return errLog(e, null, this.client);
|
||||
this.F = string;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
async dbLoad() {
|
||||
return database.collection("User").findOne({document: this.id}).then((r, e) => {
|
||||
return database.collection("User").findOne({ document: this.id }).then((r, e) => {
|
||||
if (e) return errLog(e, null, this.client);
|
||||
this.defaultEmbed = r?.settings?.defaultEmbed || {};
|
||||
this.cachedAvatarURL = this.displayAvatarURL({format: "png", size: 4096, dynamic: true});
|
||||
this.cachedAvatarURL = this.displayAvatarURL({ format: "png", size: 4096, dynamic: true });
|
||||
this.interactions = r?.interactions || {};
|
||||
this.description = r?.description;
|
||||
this.F = r?.F;
|
||||
return this.dbLoaded = true;
|
||||
});
|
||||
}
|
||||
|
||||
async setInteractions(count) {
|
||||
return database.collection("User").updateOne({document: this.id}, { $set: { interactions: count }, $setOnInsert: { document: this.id }}, {upsert: true}, (e, r) => {
|
||||
return database.collection("User").updateOne({ document: this.id }, { $set: { interactions: count }, $setOnInsert: { document: this.id } }, { upsert: true }, (e, r) => {
|
||||
if (e) return errLog(e, null, this.client);
|
||||
this.interactions = count;
|
||||
return true;
|
||||
|
|
@ -130,7 +140,7 @@ Structures.extend("User", u => {
|
|||
}
|
||||
|
||||
async setDescription(set) {
|
||||
return database.collection("User").updateOne({document: this.id}, { $set: { description: set }, $setOnInsert: { document: this.id }}, {upsert: true}, (e, r) => {
|
||||
return database.collection("User").updateOne({ document: this.id }, { $set: { description: set }, $setOnInsert: { document: this.id } }, { upsert: true }, (e, r) => {
|
||||
if (e) return errLog(e, null, this.client);
|
||||
this.description = set;
|
||||
return true;
|
||||
|
|
@ -138,7 +148,7 @@ Structures.extend("User", u => {
|
|||
}
|
||||
|
||||
async setDefaultEmbed(set) {
|
||||
return database.collection("User").updateOne({document: this.id}, {$set:{"settings.defaultEmbed": set}, $setOnInsert: { document: this.id }}, {upsert: true}, (e) => {
|
||||
return database.collection("User").updateOne({ document: this.id }, { $set: { "settings.defaultEmbed": set }, $setOnInsert: { document: this.id } }, { upsert: true }, (e) => {
|
||||
if (e) return errLog(e, null, this.client);
|
||||
this.defaultEmbed = set;
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue