Adds eslint and linted & improved routing for interactions
This commit is contained in:
parent
83209f642c
commit
441715675c
35 changed files with 2091 additions and 463 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import {formatEmoji, Routes, Snowflake} from "discord.js";
|
||||
import {DiscordClient} from "../Discord/DiscordClient";
|
||||
import {Nullable} from "../types/Nullable";
|
||||
|
||||
export class IconCache {
|
||||
private existingIcons: Map<string, string> | undefined;
|
||||
|
|
@ -22,7 +23,7 @@ export class IconCache {
|
|||
const id = this.get(iconName);
|
||||
|
||||
return formatEmoji({
|
||||
id: id,
|
||||
id,
|
||||
name: iconName
|
||||
});
|
||||
}
|
||||
|
|
@ -47,10 +48,14 @@ export class IconCache {
|
|||
return;
|
||||
}
|
||||
|
||||
const existingEmojis: DiscordIconRequest = await this.client.RESTClient.get(
|
||||
const existingEmojis: Nullable<DiscordIconRequest> = await this.client.RESTClient.get(
|
||||
Routes.applicationEmojis(this.client.ApplicationId)
|
||||
)
|
||||
|
||||
if (!existingEmojis) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.existingIcons = new Map<string, string>(
|
||||
existingEmojis.items.map((item) => {
|
||||
return [ item.name, item.id ]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import {REST, Routes} from "discord.js";
|
||||
import path from "node:path";
|
||||
import * as fs from "node:fs";
|
||||
import svg2img from "svg2img";
|
||||
|
|
@ -14,7 +13,7 @@ export class IconDeployer {
|
|||
public async ensureExistance() {
|
||||
const directory = await fs.promises.opendir(IconDeployer.ICON_PATH);
|
||||
const addIconPromises: Promise<void>[] = [];
|
||||
for await (let dirname of directory) {
|
||||
for await (const dirname of directory) {
|
||||
const iconName = path.basename(dirname.name, '.svg').replaceAll('-','_');
|
||||
|
||||
if (this.iconCache.get(iconName) !== null) {
|
||||
|
|
@ -43,7 +42,7 @@ export class IconDeployer {
|
|||
}
|
||||
}
|
||||
},
|
||||
function (err, buffer) {
|
||||
function (_err, buffer) {
|
||||
resolve(buffer);
|
||||
}
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue