This commit is contained in:
Neko Life 2021-06-29 14:03:19 +09:00
parent b40b2857d2
commit 2e28c90c9e
8 changed files with 93 additions and 56 deletions

View file

@ -17,12 +17,8 @@ module.exports = class chat extends commando.Command {
if (!args) { if (!args) {
return trySend(msg.client, msg, "Ask me somethin?"); return trySend(msg.client, msg, "Ask me somethin?");
} }
return msg.channel.startTyping() msg.channel.startTyping();
.then( return trySend(this.client, msg, await chatAnswer(
trySend(this.client, msg, await chatAnswer( msg.cleanContent.slice((msg.guild.commandPrefix + msg.command.name).length).trim()));
msg.cleanContent.slice((msg.guild.commandPrefix + msg.command.name).length).trim()
)).then(r => r)
).catch(() => { })
.finally(msg.channel.stopTyping());
} }
}; };

28
cmds/fun/f.js Normal file
View 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);
}
};

View file

@ -217,7 +217,7 @@ module.exports = class eventlog extends commando.Command {
async function resultEmbed(the) { async function resultEmbed(the) {
const emb = defaultImageEmbed(msg, null, "Event Log Channels Configuration"); const emb = defaultImageEmbed(msg, null, "Event Log Channels Configuration");
emb 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]\`\`\``) .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 ? .addField(`Message Edit`, eventChannels?.mesEd?.channel ? `<#${eventChannels?.mesEd.channel}>\n**Ignores:** ${eventChannels?.mesEd?.ignore?.length > 0 ?
"<#" + eventChannels?.mesEd.ignore.join(">, <#") + ">" : "None"}` "<#" + eventChannels?.mesEd.ignore.join(">, <#") + ">" : "None"}`
: "Not set", true) : "Not set", true)

View file

@ -18,10 +18,14 @@ module.exports = class UnknownCommandCommand extends Command {
// eslint-disable-next-line // eslint-disable-next-line
async run(msg) { async run(msg) {
if (/^<@\!?\d{17,19}>\s.+/.test(msg.content)) { 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(); 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 { try {
return await msg.channel.send( return await msg.channel.send(
`Unknown command \`${msg.content}\`. Use ${msg.anyUsage( `Unknown command \`${msg.content}\`. Use ${msg.anyUsage(

View file

@ -23,9 +23,8 @@ function giveNickHeart(msg) {
async function letsChat(msg) { async function letsChat(msg) {
if (msg.channel.id === configFile.chatChannel && !msg.author.bot && !msg.isCommand && msg.cleanContent.length > 0) { 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) msg.channel.startTyping();
).catch(() => { }) return trySend(msg.client, msg, await chatAnswer(msg.cleanContent));
.finally(msg.channel.stopTyping());
} }
} }

View file

@ -11,7 +11,7 @@ const getColor = require("../getColor");
*/ */
module.exports = async (msg) => { module.exports = async (msg) => {
if (msg.partial) return; 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; 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.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) { if (msg.guild.eventChannels?.mesDel?.channel !== msg.channel.id && ignored === false || check) {

View file

@ -18,7 +18,7 @@ module.exports = async (msgold, msgnew) => {
let check = false; 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.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) { 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; if (!log || !msgnew.author) return;
const emb = defaultEventLogEmbed(msgnew.guild); const emb = defaultEventLogEmbed(msgnew.guild);
emb emb

View file

@ -108,6 +108,15 @@ Structures.extend("User", u => {
super(client, data); super(client, data);
this.dbLoaded = false; this.dbLoaded = false;
this.cutie = true; 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() { async dbLoad() {
@ -117,6 +126,7 @@ Structures.extend("User", u => {
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.interactions = r?.interactions || {};
this.description = r?.description; this.description = r?.description;
this.F = r?.F;
return this.dbLoaded = true; return this.dbLoaded = true;
}); });
} }