Compare commits

..

No commits in common. "47700fce827844f132df851ffa52d2fd5511317b" and "0d6e3b349df5218d19e90ce0410e6cfd59b428ee" have entirely different histories.

2 changed files with 4 additions and 15 deletions

View file

@ -20,7 +20,7 @@ class TagsCommand extends Command {
const result = await database.setTag(tagName, { content: this.type === "classic" ? this.args.slice(2).join(" ") : this.optionsArray[0].options[1].value, author: this.message.sender }, this.channel); const result = await database.setTag(tagName, { content: this.type === "classic" ? this.args.slice(2).join(" ") : this.optionsArray[0].options[1].value, author: this.message.sender }, this.channel);
this.success = true; this.success = true;
if (result) return result; if (result) return result;
return { html: `The tag <font color=\"#ff00ff\">${tagName}</font> has been <b>added</b>!` }; return `The tag \`${tagName}\` has been added!`;
} else if (cmd === "delete" || cmd === "remove") { } else if (cmd === "delete" || cmd === "remove") {
if (!tagName || !tagName.trim()) return "You need to provide the name of the tag you want to delete!"; if (!tagName || !tagName.trim()) return "You need to provide the name of the tag you want to delete!";
const getResult = await database.getTag(this.channel, tagName); const getResult = await database.getTag(this.channel, tagName);
@ -29,7 +29,7 @@ class TagsCommand extends Command {
if (getResult.author !== this.author && !owners.includes(this.author)) return "You don't own this tag!"; if (getResult.author !== this.author && !owners.includes(this.author)) return "You don't own this tag!";
await database.removeTag(tagName, this.channel); await database.removeTag(tagName, this.channel);
this.success = true; this.success = true;
return { html: `The tag <font color=\"#ff00ff\">${tagName}</font> has been <b>deleted</b>!` }; return `The tag \`${tagName}\` has been deleted!`;
} else if (cmd === "edit") { } else if (cmd === "edit") {
if (!tagName || !tagName.trim()) return "You need to provide the name of the tag you want to edit!"; if (!tagName || !tagName.trim()) return "You need to provide the name of the tag you want to edit!";
const getResult = await database.getTag(this.channel, tagName); const getResult = await database.getTag(this.channel, tagName);
@ -38,7 +38,7 @@ class TagsCommand extends Command {
if (getResult.author !== this.author && !owners.includes(this.author)) return "You don't own this tag!"; if (getResult.author !== this.author && !owners.includes(this.author)) return "You don't own this tag!";
await database.editTag(tagName, { content: this.type === "classic" ? this.args.slice(2).join(" ") : this.optionsArray[0].options[1].value, author: this.message.sender }, this.channel); await database.editTag(tagName, { content: this.type === "classic" ? this.args.slice(2).join(" ") : this.optionsArray[0].options[1].value, author: this.message.sender }, this.channel);
this.success = true; this.success = true;
return { html: `The tag <font color=\"#ff00ff\">${tagName}</font> has been <b>edited</b>!` }; return `The tag \`${tagName}\` has been edited!`;
} else if (cmd === "own" || cmd === "owner") { } else if (cmd === "own" || cmd === "owner") {
if (!tagName || !tagName.trim()) return "You need to provide the name of the tag you want to check the owner of!"; if (!tagName || !tagName.trim()) return "You need to provide the name of the tag you want to check the owner of!";
const getResult = await database.getTag(this.channel, tagName); const getResult = await database.getTag(this.channel, tagName);
@ -102,7 +102,7 @@ class TagsCommand extends Command {
}], }],
}; };
} }
return { html: getResult.content }; return getResult.content;
} }
} }

View file

@ -71,17 +71,6 @@ export default async function (matrixClient, event, room, toStartOfTimeline) {
}); });
} else if (typeof result === "object") { } else if (typeof result === "object") {
// console.log(result) // console.log(result)
if (result.html) {
const content = {
format: "org.matrix.custom.html",
body: result.html,
formatted_body: result.html,
msgtype: "m.text",
};
matrixClient.sendEvent(event.event.room_id, "m.room.message", content, "", (err, res) => {
console.log(err);
});
}
if (result.contents && result.name) { if (result.contents && result.name) {
let fileSize = 52428308; let fileSize = 52428308;
if (result.contents.length > fileSize) { if (result.contents.length > fileSize) {