Formatted code and clean up

This commit is contained in:
2022-06-06 14:59:53 +07:00
parent 8b066dde58
commit 573040362d
29 changed files with 2208 additions and 1556 deletions
+22 -18
View File
@@ -1,40 +1,44 @@
import DiscordModule, { HybridInteractionMessage } from "../utils/DiscordModule";
import { Message, CommandInteraction, Interaction } from 'discord.js';
import { Message, CommandInteraction, Interaction } from "discord.js";
import { sendHybridInteractionMessageResponse, makeInfoEmbed } from "../utils/DiscordMessage";
import DiscordProvider from "../providers/Discord";
import Users from "../services/Users"
import Environment from "../providers/Environment";
import Environment from '../providers/Environment';
import DiscordProvider from '../providers/Discord';
import Users from '../services/Users';
import DiscordModule, { HybridInteractionMessage } from '../utils/DiscordModule';
import { sendHybridInteractionMessageResponse, makeInfoEmbed } from '../utils/DiscordMessage';
const EMBEDS = {
INVITE_INFO: (data: Message | Interaction) => {
let message;
if(Users.isDeveloper(data.member?.user.id!) || !Environment.get().PRIVATE_BOT)
if (Users.isDeveloper(data.member?.user.id!) || !Environment.get().PRIVATE_BOT)
message = `[Invite ${DiscordProvider.client.user?.username} to your server!](https://discord.com/api/oauth2/authorize?client_id=${DiscordProvider.client.user?.id}&permissions=0&scope=bot%20applications.commands)`;
return makeInfoEmbed({
title: `Invite`,
description: message || `${DiscordProvider.client.user?.username}'s invite is currently private. Only the developers can add me to another server`,
user: (data instanceof Interaction) ? data.user : data.author
description:
message ||
`${DiscordProvider.client.user?.username}'s invite is currently private. Only the developers can add me to another server`,
user: data instanceof Interaction ? data.user : data.author
});
}
}
};
export default class Invite extends DiscordModule {
public id: string = 'Discord_Invite';
public commands = ['invite'];
public commandInteractionName = 'invite';
public id: string = "Discord_Invite";
public commands = ["invite"];
public commandInteractionName = "invite";
async GuildOnModuleCommand(args: any, message: Message) {
await this.run(new HybridInteractionMessage(message), args);
}
async GuildModuleCommandInteractionCreate(interaction: CommandInteraction) {
async GuildModuleCommandInteractionCreate(interaction: CommandInteraction) {
await this.run(new HybridInteractionMessage(interaction), interaction.options);
}
async run(data: HybridInteractionMessage, args: any) {
return await sendHybridInteractionMessageResponse(data, { embeds:[EMBEDS.INVITE_INFO(data.getRaw())] });
return await sendHybridInteractionMessageResponse(data, {
embeds: [EMBEDS.INVITE_INFO(data.getRaw())]
});
}
}
}