Compare commits

...

6 Commits

Author SHA1 Message Date
Alyxia Sother 7a9f748cc4
Merge branch `master` into `slash` 2022-01-16 17:04:33 +01:00
Alyxia Sother 5fc65e3c71
revert: Fix some leftover type errors 2021-12-29 20:26:31 +00:00
Alyxia Sother 3170d85376
Fix a CRITICAL BUG in the emote dump module 2021-12-29 20:17:39 +00:00
Alyxia Sother e7cc94408b
Fix some leftover type errors 2021-12-29 20:17:21 +00:00
Alyxia Sother e7217cecb5
Update to Discord.JS v13.5.0 (OL v2.2.0) 2021-12-29 15:12:28 +01:00
smartfridge 08e9ae5218
Fix random errors 2021-12-13 00:39:32 +01:00
6 changed files with 2809 additions and 2676 deletions

5435
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@
"moment": "^2.29.1", "moment": "^2.29.1",
"ms": "^2.1.3", "ms": "^2.1.3",
"node-wolfram-alpha": "^1.2.5", "node-wolfram-alpha": "^1.2.5",
"onion-lasers": "npm:onion-lasers-v13@^2.1.0", "onion-lasers": "npm:onion-lasers-v13@^2.2.0",
"pet-pet-gif": "^1.0.9", "pet-pet-gif": "^1.0.9",
"relevant-urban": "^2.0.0", "relevant-urban": "^2.0.0",
"weather-js": "^2.0.0" "weather-js": "^2.0.0"

View File

@ -1,6 +1,6 @@
import {pluralise} from "../../../lib"; import {pluralise} from "../../../lib";
import {Storage} from "../../../structures"; import {Storage} from "../../../structures";
import {User, Guild, TextChannel, DMChannel, NewsChannel, Channel, TextBasedChannels} from "discord.js"; import {User, Guild, TextChannel, DMChannel, NewsChannel, Channel, TextBasedChannel} from "discord.js";
export const ECO_EMBED_COLOR = 0xf1c40f; export const ECO_EMBED_COLOR = 0xf1c40f;
@ -89,7 +89,7 @@ export function getSendEmbed(sender: User, receiver: User, amount: number): obje
}; };
} }
export function isAuthorized(guild: Guild | null, channel: TextBasedChannels): boolean { export function isAuthorized(guild: Guild | null, channel: TextBasedChannel): boolean {
if (IS_DEV_MODE) { if (IS_DEV_MODE) {
return true; return true;
} }

View File

@ -10,11 +10,11 @@ export default new NamedCommand({
const attachment = message.attachments.first()!; const attachment = message.attachments.first()!;
const gif = await petPetGif(attachment.url); const gif = await petPetGif(attachment.url);
const file = new MessageAttachment(gif, "pat.gif"); const file = new MessageAttachment(gif, "pat.gif");
send({attachments: [file]}); send({files: [file]});
} else { } else {
const gif = await petPetGif(author.displayAvatarURL({format: "png"})); const gif = await petPetGif(author.displayAvatarURL({format: "png"}));
const file = new MessageAttachment(gif, "pat.gif"); const file = new MessageAttachment(gif, "pat.gif");
send({attachments: [file]}); send({files: [file]});
} }
}, },
id: "user", id: "user",
@ -24,7 +24,7 @@ export default new NamedCommand({
const user: User = args[0]; const user: User = args[0];
const gif = await petPetGif(user.displayAvatarURL({format: "png"})); const gif = await petPetGif(user.displayAvatarURL({format: "png"}));
const file = new MessageAttachment(gif, "pat.gif"); const file = new MessageAttachment(gif, "pat.gif");
send({attachments: [file]}); send({files: [file]});
} }
}), }),
any: new RestCommand({ any: new RestCommand({
@ -36,7 +36,7 @@ export default new NamedCommand({
else { else {
const gif = await petPetGif(user.displayAvatarURL({format: "png"})); const gif = await petPetGif(user.displayAvatarURL({format: "png"}));
const file = new MessageAttachment(gif, "pat.gif"); const file = new MessageAttachment(gif, "pat.gif");
send({attachments: [file]}); send({files: [file]});
} }
} }
}) })

View File

@ -1,5 +1,5 @@
import {NamedCommand, RestCommand} from "onion-lasers"; import {NamedCommand, RestCommand} from "onion-lasers";
import {Message, Channel, TextChannel, TextBasedChannels} from "discord.js"; import {Message, Channel, TextChannel, TextBasedChannel} from "discord.js";
import {processEmoteQuery} from "./modules/emote-utils"; import {processEmoteQuery} from "./modules/emote-utils";
export default new NamedCommand({ export default new NamedCommand({
@ -29,7 +29,7 @@ export default new NamedCommand({
const guildID = match[1]; const guildID = match[1];
const channelID = match[2]; const channelID = match[2];
const messageID = match[3]; const messageID = match[3];
let tmpChannel: TextBasedChannels | undefined = channel; let tmpChannel: TextBasedChannel | undefined = channel;
if (guild?.id !== guildID) { if (guild?.id !== guildID) {
try { try {
@ -40,7 +40,7 @@ export default new NamedCommand({
} }
if (tmpChannel?.id !== channelID) if (tmpChannel?.id !== channelID)
tmpChannel = guild.channels.cache.get(channelID) as TextBasedChannels; tmpChannel = guild.channels.cache.get(channelID) as TextBasedChannel;
if (!tmpChannel) return send(`\`${channelID}\` is an invalid channel ID!`); if (!tmpChannel) return send(`\`${channelID}\` is an invalid channel ID!`);
if (message.id !== messageID) { if (message.id !== messageID) {
@ -58,10 +58,10 @@ export default new NamedCommand({
const match = copyIDPattern.exec(last)!; const match = copyIDPattern.exec(last)!;
const channelID = match[1]; const channelID = match[1];
const messageID = match[2]; const messageID = match[2];
let tmpChannel: TextBasedChannels | undefined = channel; let tmpChannel: TextBasedChannel | undefined = channel;
if (tmpChannel?.id !== channelID) if (tmpChannel?.id !== channelID)
tmpChannel = guild?.channels.cache.get(channelID) as TextBasedChannels; tmpChannel = guild?.channels.cache.get(channelID) as TextBasedChannel;
if (!tmpChannel) return send(`\`${channelID}\` is an invalid channel ID!`); if (!tmpChannel) return send(`\`${channelID}\` is an invalid channel ID!`);
if (message.id !== messageID) { if (message.id !== messageID) {

View File

@ -6,18 +6,20 @@ function updateGlobalEmoteRegistry(): void {
const data: EmoteRegistryDump = {version: 1, list: []}; const data: EmoteRegistryDump = {version: 1, list: []};
for (const guild of client.guilds.cache.values()) { for (const guild of client.guilds.cache.values()) {
for (const emote of guild.emojis.cache.values()) { guild.fetch().then((g) => {
data.list.push({ for (const emote of g.emojis.cache.values()) {
ref: emote.name, data.list.push({
id: emote.id, ref: emote.name,
name: emote.name, id: emote.id,
requires_colons: emote.requiresColons ?? false, name: emote.name,
animated: emote.animated ?? false, requires_colons: emote.requiresColons ?? false,
url: emote.url, animated: emote.animated ?? false,
guild_id: emote.guild.name, url: emote.url,
guild_name: emote.guild.name guild_id: emote.guild.name,
}); guild_name: emote.guild.name
} });
}
});
} }
FileManager.open("data/public"); // generate folder if it doesn't exist FileManager.open("data/public"); // generate folder if it doesn't exist