fixed tags, there are no "guilds" in matrix

This commit is contained in:
murm 2023-03-17 01:19:50 -04:00
parent e9d6a0fe48
commit 0d6e3b349d
2 changed files with 41 additions and 42 deletions

View file

@ -17,7 +17,7 @@ class TagsCommand extends Command {
if (blacklist.includes(tagName)) return "You can't make a tag with that name!";
const getResult = await database.getTag(this.channel, tagName);
if (getResult) return "This tag already exists!";
const result = await database.setTag(tagName, { content: this.type === "classic" ? this.args.slice(2).join(" ") : this.optionsArray[0].options[1].value, author: this.member.id }, this.guild);
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;
if (result) return result;
return `The tag \`${tagName}\` has been added!`;
@ -27,7 +27,7 @@ class TagsCommand extends Command {
if (!getResult) return "This tag doesn't exist!";
const owners = process.env.OWNER.split(",");
if (getResult.author !== this.author && !owners.includes(this.author)) return "You don't own this tag!";
await database.removeTag(tagName, this.guild);
await database.removeTag(tagName, this.channel);
this.success = true;
return `The tag \`${tagName}\` has been deleted!`;
} else if (cmd === "edit") {
@ -36,7 +36,7 @@ class TagsCommand extends Command {
if (!getResult) return "This tag doesn't exist!";
const owners = process.env.OWNER.split(",");
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.member.id }, this.guild);
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;
return `The tag \`${tagName}\` has been edited!`;
} else if (cmd === "own" || cmd === "owner") {
@ -56,7 +56,6 @@ class TagsCommand extends Command {
return `This tag is owned by **${user.username}#${user.discriminator}** (\`${getResult.author}\`).`;
}
} else if (cmd === "list") {
if (!this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) return "I don't have the `Embed Links` permission!";
const tagList = await database.getTags(this.channel);
const embeds = [];
const groups = Object.keys(tagList).map((item, index) => {