Merge branch master into slash

This commit is contained in:
Alyxia Sother 2022-01-16 17:04:33 +01:00
commit 7a9f748cc4
No known key found for this signature in database
GPG key ID: 355968D14144B739
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",
"ms": "^2.1.3",
"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",
"relevant-urban": "^2.0.0",
"weather-js": "^2.0.0"

View file

@ -1,6 +1,6 @@
import {pluralise} from "../../../lib";
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;
@ -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) {
return true;
}

View file

@ -10,11 +10,11 @@ export default new NamedCommand({
const attachment = message.attachments.first()!;
const gif = await petPetGif(attachment.url);
const file = new MessageAttachment(gif, "pat.gif");
send({attachments: [file]});
send({files: [file]});
} else {
const gif = await petPetGif(author.displayAvatarURL({format: "png"}));
const file = new MessageAttachment(gif, "pat.gif");
send({attachments: [file]});
send({files: [file]});
}
},
id: "user",
@ -24,7 +24,7 @@ export default new NamedCommand({
const user: User = args[0];
const gif = await petPetGif(user.displayAvatarURL({format: "png"}));
const file = new MessageAttachment(gif, "pat.gif");
send({attachments: [file]});
send({files: [file]});
}
}),
any: new RestCommand({
@ -36,7 +36,7 @@ export default new NamedCommand({
else {
const gif = await petPetGif(user.displayAvatarURL({format: "png"}));
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 {Message, Channel, TextChannel, TextBasedChannels} from "discord.js";
import {Message, Channel, TextChannel, TextBasedChannel} from "discord.js";
import {processEmoteQuery} from "./modules/emote-utils";
export default new NamedCommand({
@ -29,7 +29,7 @@ export default new NamedCommand({
const guildID = match[1];
const channelID = match[2];
const messageID = match[3];
let tmpChannel: TextBasedChannels | undefined = channel;
let tmpChannel: TextBasedChannel | undefined = channel;
if (guild?.id !== guildID) {
try {
@ -40,7 +40,7 @@ export default new NamedCommand({
}
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 (message.id !== messageID) {
@ -58,10 +58,10 @@ export default new NamedCommand({
const match = copyIDPattern.exec(last)!;
const channelID = match[1];
const messageID = match[2];
let tmpChannel: TextBasedChannels | undefined = channel;
let tmpChannel: TextBasedChannel | undefined = channel;
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 (message.id !== messageID) {

View file

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