mirror of
https://github.com/kirameki-cafe/Yumi.git
synced 2026-09-13 18:59:19 +00:00
Changed to use init function instead
This commit is contained in:
+15
-25
@@ -14,31 +14,7 @@ enum MeasureType {
|
||||
DiscordWebsocket = "discordwebsocket"
|
||||
}
|
||||
|
||||
let measureList = [
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
let measureList: any = [];
|
||||
|
||||
const EMBEDS = {
|
||||
PING_INFO: (data: Message | Interaction, description: string) => {
|
||||
@@ -53,6 +29,20 @@ const EMBEDS = {
|
||||
|
||||
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) {
|
||||
if (command.toLowerCase() !== 'ping') return;
|
||||
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'))) {
|
||||
try {
|
||||
@@ -133,11 +136,9 @@ if (fs.existsSync(path.join(process.cwd(), 'configs/ServiceAnnouncement.json')))
|
||||
} catch (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) {
|
||||
if (command.toLowerCase() !== 'serviceannouncement') return;
|
||||
await this.process(message, args);
|
||||
|
||||
Reference in New Issue
Block a user