Compare commits

..

No commits in common. "e9d6a0fe486f44dbdb5de1dbfdd3c877413333f8" and "776e4908ba48c6e8283d1356dbc289917245a4b9" have entirely different histories.

29 changed files with 29 additions and 30 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 467 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 810 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 591 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 221 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 328 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 515 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 619 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 350 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

View file

@ -8,6 +8,7 @@ class TagsCommand extends Command {
// todo: attempt to not make this file the worst thing that human eyes have ever seen // todo: attempt to not make this file the worst thing that human eyes have ever seen
async run() { async run() {
this.success = false; this.success = false;
if (!this.guild) return "This command only works in servers!";
const cmd = this.type === "classic" ? (this.args[0] ?? "").toLowerCase() : this.optionsArray[0].name; const cmd = this.type === "classic" ? (this.args[0] ?? "").toLowerCase() : this.optionsArray[0].name;
if (!cmd || !cmd.trim()) return "You need to provide the name of the tag you want to view!"; if (!cmd || !cmd.trim()) return "You need to provide the name of the tag you want to view!";
const tagName = this.type === "classic" ? this.args.slice(1)[0] : (this.optionsArray[0].options[0] ?? {}).value; const tagName = this.type === "classic" ? this.args.slice(1)[0] : (this.optionsArray[0].options[0] ?? {}).value;
@ -15,7 +16,7 @@ class TagsCommand extends Command {
if (cmd === "create" || cmd === "add") { if (cmd === "create" || cmd === "add") {
if (!tagName || !tagName.trim()) return "You need to provide the name of the tag you want to add!"; if (!tagName || !tagName.trim()) return "You need to provide the name of the tag you want to add!";
if (blacklist.includes(tagName)) return "You can't make a tag with that name!"; if (blacklist.includes(tagName)) return "You can't make a tag with that name!";
const getResult = await database.getTag(this.channel, tagName); const getResult = await database.getTag(this.guild.id, tagName);
if (getResult) return "This tag already exists!"; 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.member.id }, this.guild);
this.success = true; this.success = true;
@ -23,25 +24,25 @@ class TagsCommand extends Command {
return `The tag \`${tagName}\` has been added!`; 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.guild.id, tagName);
if (!getResult) return "This tag doesn't exist!"; if (!getResult) return "This tag doesn't exist!";
const owners = process.env.OWNER.split(","); const owners = process.env.OWNER.split(",");
if (getResult.author !== this.author && !owners.includes(this.author)) return "You don't own this tag!"; if (getResult.author !== this.author && !this.member.permissions.has("MANAGE_MESSAGES") && !owners.includes(this.author)) return "You don't own this tag!";
await database.removeTag(tagName, this.guild); await database.removeTag(tagName, this.guild);
this.success = true; this.success = true;
return `The tag \`${tagName}\` has been deleted!`; 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.guild.id, tagName);
if (!getResult) return "This tag doesn't exist!"; if (!getResult) return "This tag doesn't exist!";
const owners = process.env.OWNER.split(","); const owners = process.env.OWNER.split(",");
if (getResult.author !== this.author && !owners.includes(this.author)) return "You don't own this tag!"; if (getResult.author !== this.author && !this.member.permissions.has("MANAGE_MESSAGES") && !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.member.id }, this.guild);
this.success = true; this.success = true;
return `The tag \`${tagName}\` has been edited!`; 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.guild.id, tagName);
if (!getResult) return "This tag doesn't exist!"; if (!getResult) return "This tag doesn't exist!";
const user = this.client.users.get(getResult.author); const user = this.client.users.get(getResult.author);
this.success = true; this.success = true;
@ -57,41 +58,39 @@ class TagsCommand extends Command {
} }
} else if (cmd === "list") { } 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!"; 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 tagList = await database.getTags(this.guild.id);
const embeds = []; const embeds = [];
const groups = Object.keys(tagList).map((item, index) => { const groups = Object.keys(tagList).map((item, index) => {
return index % 15 === 0 ? Object.keys(tagList).slice(index, index + 15) : null; return index % 15 === 0 ? Object.keys(tagList).slice(index, index + 15) : null;
}).filter((item) => { }).filter((item) => {
return item; return item;
}); });
let output = JSON.stringify(groups.entries()); for (const [i, value] of groups.entries()) {
// for (const [i, value] of groups.entries()) { embeds.push({
// // embeds.push({ embeds: [{
// // embeds: [{ title: "Tag List",
// // title: "Tag List", color: 16711680,
// // color: 16711680, footer: {
// // footer: { text: `Page ${i + 1} of ${groups.length}`
// // text: `Page ${i + 1} of ${groups.length}` },
// // }, description: value.join("\n"),
// // description: value.join("\n"), author: {
// // author: { name: this.author.username,
// // name: this.author.username, iconURL: this.author.avatarURL()
// // iconURL: this.author.avatarURL() }
// // } }]
// // }] });
// // }); }
// }
if (embeds.length === 0) return "I couldn't find any tags!"; if (embeds.length === 0) return "I couldn't find any tags!";
this.success = true; this.success = true;
return output; return paginator(this.client, { type: this.type, message: this.message, interaction: this.interaction, channel: this.channel, author: this.author }, embeds);
// return paginator(this.client, { type: this.type, message: this.message, interaction: this.interaction, channel: this.channel, author: this.author }, embeds);
} else { } else {
let getResult; let getResult;
if (cmd === "random") { if (cmd === "random") {
const tagList = await database.getTags(this.channel); const tagList = await database.getTags(this.guild.id);
getResult = tagList[random(Object.keys(tagList))]; getResult = tagList[random(Object.keys(tagList))];
} else { } else {
getResult = await database.getTag(this.channel, this.type === "classic" ? cmd : tagName); getResult = await database.getTag(this.guild.id, this.type === "classic" ? cmd : tagName);
} }
if (!getResult) return "This tag doesn't exist!"; if (!getResult) return "This tag doesn't exist!";
this.success = true; this.success = true;

View file

@ -7,7 +7,7 @@ using namespace vips;
char *Explode(string type, string *outType, char *BufferData, char *Explode(string type, string *outType, char *BufferData,
size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) {
bool implode = GetArgumentWithFallback<bool>(Arguments, "implode", false); bool implode = GetArgument<bool>(Arguments, "implode");
string basePath = GetArgument<string>(Arguments, "basePath"); string basePath = GetArgument<string>(Arguments, "basePath");
VOption *options = VImage::option(); VOption *options = VImage::option();

View file

@ -7,7 +7,7 @@ using namespace vips;
char *Reddit(string type, string *outType, char *BufferData, char *Reddit(string type, string *outType, char *BufferData,
size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) {
string text = GetArgumentWithFallback<string>(Arguments, "text", ""); string text = GetArgument<string>(Arguments, "text");
string basePath = GetArgument<string>(Arguments, "basePath"); string basePath = GetArgument<string>(Arguments, "basePath");
VOption *options = VImage::option()->set("access", "sequential"); VOption *options = VImage::option()->set("access", "sequential");