mirror of
https://github.com/keanuplayz/TravBot-v3.git
synced 2024-08-15 02:33:12 +00:00
Removed structure redundancy and saves to data/
This commit is contained in:
parent
68d8eed4ed
commit
5537cec29a
3 changed files with 5 additions and 15 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -7,7 +7,6 @@ test*
|
||||||
!test/
|
!test/
|
||||||
*.bat
|
*.bat
|
||||||
desktop.ini
|
desktop.ini
|
||||||
emote-registry.json
|
|
||||||
|
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import {writeFileSync} from "fs";
|
|
||||||
import {GenericWrapper, NumberWrapper, StringWrapper, ArrayWrapper} from "./wrappers";
|
import {GenericWrapper, NumberWrapper, StringWrapper, ArrayWrapper} from "./wrappers";
|
||||||
import {Client, Message, TextChannel, DMChannel, NewsChannel, Guild, User, GuildMember, Permissions} from "discord.js";
|
import {Client, Message, TextChannel, DMChannel, NewsChannel, Guild, User, GuildMember, Permissions} from "discord.js";
|
||||||
import chalk from "chalk";
|
import chalk from "chalk";
|
||||||
|
@ -163,28 +162,22 @@ export function botHasPermission(guild: Guild | null, permission: number): boole
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateGlobalEmoteRegistry(): void {
|
export function updateGlobalEmoteRegistry(): void {
|
||||||
const data: EmoteRegistryDump = {version: 1, list: []};
|
const list: EmoteRegistryDumpEntry[] = [];
|
||||||
|
|
||||||
for (const guild of client.guilds.cache.values()) {
|
for (const guild of client.guilds.cache.values()) {
|
||||||
$.debug(client.guilds.cache.size);
|
|
||||||
for (const emote of guild.emojis.cache.values()) {
|
for (const emote of guild.emojis.cache.values()) {
|
||||||
$.debug(client.emojis.cache.size);
|
list.push({
|
||||||
console.log("HELLO?!");
|
|
||||||
data.list.push({
|
|
||||||
ref: emote.name,
|
|
||||||
id: emote.id,
|
id: emote.id,
|
||||||
name: emote.name,
|
name: emote.name,
|
||||||
requires_colons: emote.requiresColons || false,
|
requires_colons: emote.requiresColons || false,
|
||||||
animated: emote.animated,
|
animated: emote.animated,
|
||||||
url: emote.url,
|
url: emote.url,
|
||||||
guild_id: emote.guild.name,
|
|
||||||
guild_name: emote.guild.name
|
guild_name: emote.guild.name
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const sData = JSON.stringify(data);
|
|
||||||
$.debug(data);
|
FileManager.write("emote-registry", {version: 1, list}, true);
|
||||||
$.debug(sData);
|
|
||||||
writeFileSync("emote-registry.json", sData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pagination function that allows for customization via a callback.
|
// Pagination function that allows for customization via a callback.
|
||||||
|
|
|
@ -108,13 +108,11 @@ export function getPrefix(guild: DiscordGuild | null): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EmoteRegistryDumpEntry {
|
export interface EmoteRegistryDumpEntry {
|
||||||
ref: string;
|
|
||||||
id: Snowflake;
|
id: Snowflake;
|
||||||
name: string;
|
name: string;
|
||||||
requires_colons: boolean;
|
requires_colons: boolean;
|
||||||
animated: boolean;
|
animated: boolean;
|
||||||
url: string;
|
url: string;
|
||||||
guild_id: Snowflake;
|
|
||||||
guild_name: string;
|
guild_name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue