mirror of
https://github.com/kirameki-cafe/Yumi.git
synced 2026-09-14 11:19:24 +00:00
Changed to use init function instead
This commit is contained in:
+15
-25
@@ -14,31 +14,7 @@ enum MeasureType {
|
|||||||
DiscordWebsocket = "discordwebsocket"
|
DiscordWebsocket = "discordwebsocket"
|
||||||
}
|
}
|
||||||
|
|
||||||
let measureList = [
|
let measureList: any = [];
|
||||||
{
|
|
||||||
type: MeasureType.Ping,
|
|
||||||
title: "☁️ Internet | ",
|
|
||||||
host: "1.1.1.1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: MeasureType.DiscordWebsocket,
|
|
||||||
title: "🚀 Discord Websocket | "
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: MeasureType.DiscordHTTPPing,
|
|
||||||
title: "🏓 Discord HTTP | "
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
if(fs.existsSync(path.join(process.cwd(), 'configs/Ping.json'))) {
|
|
||||||
try {
|
|
||||||
const rawData = fs.readFileSync(path.join(process.cwd(), 'configs/Ping.json'));
|
|
||||||
const jsonData = JSON.parse(rawData.toString());
|
|
||||||
measureList = jsonData;
|
|
||||||
} catch (err) {
|
|
||||||
Logger.error("Unable to load custom Ping config: " + err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const EMBEDS = {
|
const EMBEDS = {
|
||||||
PING_INFO: (data: Message | Interaction, description: string) => {
|
PING_INFO: (data: Message | Interaction, description: string) => {
|
||||||
@@ -53,6 +29,20 @@ const EMBEDS = {
|
|||||||
|
|
||||||
export default class Ping {
|
export default class Ping {
|
||||||
|
|
||||||
|
async init() {
|
||||||
|
|
||||||
|
if (fs.existsSync(path.join(process.cwd(), 'configs/Ping.json'))) {
|
||||||
|
try {
|
||||||
|
const rawData = fs.readFileSync(path.join(process.cwd(), 'configs/Ping.json'));
|
||||||
|
const jsonData = JSON.parse(rawData.toString());
|
||||||
|
measureList = jsonData;
|
||||||
|
} catch (err) {
|
||||||
|
Logger.error("Unable to load custom Ping config: " + err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
async onCommand(command: string, args: any, message: Message) {
|
async onCommand(command: string, args: any, message: Message) {
|
||||||
if (command.toLowerCase() !== 'ping') return;
|
if (command.toLowerCase() !== 'ping') return;
|
||||||
await this.process(message, args);
|
await this.process(message, args);
|
||||||
|
|||||||
@@ -124,6 +124,9 @@ let Announcements = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
export default class InteractionManager {
|
||||||
|
|
||||||
|
async init() {
|
||||||
|
|
||||||
if (fs.existsSync(path.join(process.cwd(), 'configs/ServiceAnnouncement.json'))) {
|
if (fs.existsSync(path.join(process.cwd(), 'configs/ServiceAnnouncement.json'))) {
|
||||||
try {
|
try {
|
||||||
@@ -133,11 +136,9 @@ if (fs.existsSync(path.join(process.cwd(), 'configs/ServiceAnnouncement.json')))
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
Logger.error("Unable to load custom ServiceAnnouncement config: " + err);
|
Logger.error("Unable to load custom ServiceAnnouncement config: " + err);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
fs.writeFileSync(path.join(process.cwd(), 'configs/ServiceAnnouncement.json'), JSON.stringify(Announcements, null, 4), 'utf8');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class InteractionManager {
|
|
||||||
async onCommand(command: string, args: any, message: Message) {
|
async onCommand(command: string, args: any, message: Message) {
|
||||||
if (command.toLowerCase() !== 'serviceannouncement') return;
|
if (command.toLowerCase() !== 'serviceannouncement') return;
|
||||||
await this.process(message, args);
|
await this.process(message, args);
|
||||||
|
|||||||
Reference in New Issue
Block a user