Feature/81 slash command support #192

Merged
Vylpes merged 6 commits from feature/81-slash-command-support into develop 2022-09-18 11:57:22 +01:00
26 changed files with 10 additions and 63 deletions
Showing only changes of commit 8ee8bf5e9f - Show all commits

View file

@ -1,7 +1,6 @@
import { Client } from "discord.js"; import { Client } from "discord.js";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import { createConnection } from "typeorm"; import { createConnection } from "typeorm";
import DefaultValues from "../constants/DefaultValues";
import ICommandItem from "../contracts/ICommandItem"; import ICommandItem from "../contracts/ICommandItem";
import IEventItem from "../contracts/IEventItem"; import IEventItem from "../contracts/IEventItem";
import { Command } from "../type/command"; import { Command } from "../type/command";

View file

@ -1,19 +1,12 @@
VylpesTester commented 2022-09-17 19:21:27 +01:00 (Migrated from github.com)
Review

Process.env isn't there anymore

Process.env isn't there anymore
VylpesTester commented 2022-09-17 19:21:27 +01:00 (Migrated from github.com)
Review

Process.env isn't there anymore

Process.env isn't there anymore
import { CommandInteraction, GuildMemberRoleManager, Interaction, Message, messageLink } from "discord.js"; import { GuildMemberRoleManager, Interaction } from "discord.js";
VylpesTester commented 2022-09-17 19:21:27 +01:00 (Migrated from github.com)
Review

Process.env isn't there anymore

Process.env isn't there anymore
VylpesTester commented 2022-09-17 19:21:27 +01:00 (Migrated from github.com)
Review

Process.env isn't there anymore

Process.env isn't there anymore
import { CommandResponse } from "../constants/CommandResponse"; import { CommandResponse } from "../constants/CommandResponse";
import ErrorMessages from "../constants/ErrorMessages"; import ErrorMessages from "../constants/ErrorMessages";
import ICommandItem from "../contracts/ICommandItem"; import ICommandItem from "../contracts/ICommandItem";
import SettingsHelper from "../helpers/SettingsHelper"; import SettingsHelper from "../helpers/SettingsHelper";
import StringTools from "../helpers/StringTools"; import StringTools from "../helpers/StringTools";
import { CoreClient } from "./client"; import { CoreClient } from "./client";
import { Util } from "./util";
VylpesTester commented 2022-09-17 19:21:27 +01:00 (Migrated from github.com)
Review

Process.env isn't there anymore

Process.env isn't there anymore
export class Events { export class Events {
private _util: Util;
VylpesTester commented 2022-09-17 19:21:27 +01:00 (Migrated from github.com)
Review

Process.env isn't there anymore

Process.env isn't there anymore
VylpesTester commented 2022-09-17 19:21:27 +01:00 (Migrated from github.com)
Review

Process.env isn't there anymore

Process.env isn't there anymore
constructor() {
VylpesTester commented 2022-09-17 19:21:27 +01:00 (Migrated from github.com)
Review

Process.env isn't there anymore

Process.env isn't there anymore
this._util = new Util();
VylpesTester commented 2022-09-17 19:21:27 +01:00 (Migrated from github.com)
Review

Process.env isn't there anymore

Process.env isn't there anymore
}
VylpesTester commented 2022-09-17 19:21:27 +01:00 (Migrated from github.com)
Review

Process.env isn't there anymore

Process.env isn't there anymore
VylpesTester commented 2022-09-17 19:21:27 +01:00 (Migrated from github.com)
Review

Process.env isn't there anymore

Process.env isn't there anymore
public async onInteractionCreate(interaction: Interaction) { public async onInteractionCreate(interaction: Interaction) {
if (!interaction.isChatInputCommand()) return; if (!interaction.isChatInputCommand()) return;
if (!interaction.guild) return; if (!interaction.guild) return;

VylpesTester commented 2022-09-17 19:21:27 +01:00 (Migrated from github.com)
Review

Process.env isn't there anymore

Process.env isn't there anymore
VylpesTester commented 2022-09-17 19:21:27 +01:00 (Migrated from github.com)
Review

Process.env isn't there anymore

Process.env isn't there anymore

View file

@ -1,15 +1,7 @@
// Required Components import { Client, REST, Routes, SlashCommandBuilder } from "discord.js";
import { Client, Message, REST, Routes, SlashCommandBuilder } from "discord.js";
import { ICommandContext } from "../contracts/ICommandContext";
import ICommandItem from "../contracts/ICommandItem";
import IEventItem from "../contracts/IEventItem"; import IEventItem from "../contracts/IEventItem";
import SettingsHelper from "../helpers/SettingsHelper";
import StringTools from "../helpers/StringTools";
import { CommandResponse } from "../constants/CommandResponse";
import ErrorMessages from "../constants/ErrorMessages";
import { CoreClient } from "./client"; import { CoreClient } from "./client";
// Util Class
export class Util { export class Util {
public loadSlashCommands(client: Client) { public loadSlashCommands(client: Client) {
const registeredCommands = CoreClient.commandItems; const registeredCommands = CoreClient.commandItems;

View file

@ -1,6 +1,5 @@
import { CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js"; import { CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import EmbedColours from "../../constants/EmbedColours"; import EmbedColours from "../../constants/EmbedColours";
import { ICommandContext } from "../../contracts/ICommandContext";
import SettingsHelper from "../../helpers/SettingsHelper"; import SettingsHelper from "../../helpers/SettingsHelper";
import { Command } from "../../type/command"; import { Command } from "../../type/command";

View file

@ -1,9 +1,7 @@
import { CommandInteraction, GuildMemberRoleManager, SlashCommandBuilder, TextChannel } from "discord.js"; import { CommandInteraction, GuildMemberRoleManager, SlashCommandBuilder } from "discord.js";
import { ICommandContext } from "../../contracts/ICommandContext";
import { Command } from "../../type/command"; import { Command } from "../../type/command";
import { default as eLobby } from "../../entity/501231711271780357/Lobby"; import { default as eLobby } from "../../entity/501231711271780357/Lobby";
import SettingsHelper from "../../helpers/SettingsHelper"; import SettingsHelper from "../../helpers/SettingsHelper";
import { readFileSync } from "fs";
import BaseEntity from "../../contracts/BaseEntity"; import BaseEntity from "../../contracts/BaseEntity";
export default class Lobby extends Command { export default class Lobby extends Command {

View file

@ -1,6 +1,5 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, CommandInteraction, EmbedBuilder, Interaction, SlashCommandBuilder } from "discord.js"; import { ActionRowBuilder, ButtonBuilder, ButtonStyle, CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import EmbedColours from "../constants/EmbedColours"; import EmbedColours from "../constants/EmbedColours";
import { ICommandContext } from "../contracts/ICommandContext";
import { Command } from "../type/command"; import { Command } from "../type/command";
export default class About extends Command { export default class About extends Command {

View file

@ -1,8 +1,6 @@
import { ICommandContext } from "../contracts/ICommandContext";
import Audit from "../entity/Audit"; import Audit from "../entity/Audit";
import AuditTools from "../helpers/AuditTools"; import AuditTools from "../helpers/AuditTools";
import { Command } from "../type/command"; import { Command } from "../type/command";
import SettingsHelper from "../helpers/SettingsHelper";
import { CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js"; import { CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { AuditType } from "../constants/AuditType"; import { AuditType } from "../constants/AuditType";
import EmbedColours from "../constants/EmbedColours"; import EmbedColours from "../constants/EmbedColours";

View file

@ -1,6 +1,4 @@
import ErrorMessages from "../constants/ErrorMessages";
import { Command } from "../type/command"; import { Command } from "../type/command";
import { ICommandContext } from "../contracts/ICommandContext";
import Audit from "../entity/Audit"; import Audit from "../entity/Audit";
import { AuditType } from "../constants/AuditType"; import { AuditType } from "../constants/AuditType";
import { CommandInteraction, EmbedBuilder, GuildMember, PermissionsBitField, SlashCommandBuilder, TextChannel } from "discord.js"; import { CommandInteraction, EmbedBuilder, GuildMember, PermissionsBitField, SlashCommandBuilder, TextChannel } from "discord.js";

View file

@ -1,5 +1,4 @@
import { Command } from "../type/command"; import { Command } from "../type/command";
import { ICommandContext } from "../contracts/ICommandContext";
import randomBunny from "random-bunny"; import randomBunny from "random-bunny";
import { CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js"; import { CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import EmbedColours from "../constants/EmbedColours"; import EmbedColours from "../constants/EmbedColours";

View file

@ -1,6 +1,5 @@
import { CommandInteraction, SlashCommandBuilder, TextChannel } from "discord.js"; import { CommandInteraction, SlashCommandBuilder, TextChannel } from "discord.js";
import { Command } from "../type/command"; import { Command } from "../type/command";
import { ICommandContext } from "../contracts/ICommandContext";
export default class Clear extends Command { export default class Clear extends Command {
constructor() { constructor() {

View file

@ -1,6 +1,5 @@
import { CommandInteraction, EmbedBuilder, SlashCommandBuilder, SlashCommandSubcommandBuilder } from "discord.js"; import { CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { CommandResponse } from "../constants/CommandResponse"; import { CommandResponse } from "../constants/CommandResponse";
import { ICommandContext } from "../contracts/ICommandContext";
import SettingsHelper from "../helpers/SettingsHelper"; import SettingsHelper from "../helpers/SettingsHelper";
import StringTools from "../helpers/StringTools"; import StringTools from "../helpers/StringTools";
import { Command } from "../type/command"; import { Command } from "../type/command";

View file

@ -3,7 +3,6 @@ import { readFileSync } from "fs";
import { CommandResponse } from "../constants/CommandResponse"; import { CommandResponse } from "../constants/CommandResponse";
import DefaultValues from "../constants/DefaultValues"; import DefaultValues from "../constants/DefaultValues";
import EmbedColours from "../constants/EmbedColours"; import EmbedColours from "../constants/EmbedColours";
import { ICommandContext } from "../contracts/ICommandContext";
import Server from "../entity/Server"; import Server from "../entity/Server";
import Setting from "../entity/Setting"; import Setting from "../entity/Setting";
import { Command } from "../type/command"; import { Command } from "../type/command";

View file

@ -1,5 +1,4 @@
import { CommandInteraction, SlashCommandBuilder } from "discord.js"; import { CommandInteraction, SlashCommandBuilder } from "discord.js";
import { ICommandContext } from "../contracts/ICommandContext";
import SettingsHelper from "../helpers/SettingsHelper"; import SettingsHelper from "../helpers/SettingsHelper";
import { Command } from "../type/command"; import { Command } from "../type/command";

View file

@ -1,5 +1,4 @@
import { CommandInteraction, SlashCommandBuilder } from "discord.js"; import { CommandInteraction, SlashCommandBuilder } from "discord.js";
import { ICommandContext } from "../contracts/ICommandContext";
import IgnoredChannel from "../entity/IgnoredChannel"; import IgnoredChannel from "../entity/IgnoredChannel";
import { Command } from "../type/command"; import { Command } from "../type/command";

View file

@ -1,6 +1,4 @@
import ErrorMessages from "../constants/ErrorMessages";
import { Command } from "../type/command"; import { Command } from "../type/command";
import { ICommandContext } from "../contracts/ICommandContext";
import Audit from "../entity/Audit"; import Audit from "../entity/Audit";
import { AuditType } from "../constants/AuditType"; import { AuditType } from "../constants/AuditType";
import { CommandInteraction, EmbedBuilder, GuildMember, PermissionsBitField, SlashCommandBuilder, TextChannel } from "discord.js"; import { CommandInteraction, EmbedBuilder, GuildMember, PermissionsBitField, SlashCommandBuilder, TextChannel } from "discord.js";

View file

@ -1,8 +1,6 @@
import { CommandInteraction, EmbedBuilder, GuildMember, PermissionsBitField, SlashCommandBuilder, TextChannel } from "discord.js"; import { CommandInteraction, EmbedBuilder, GuildMember, PermissionsBitField, SlashCommandBuilder, TextChannel } from "discord.js";
import { AuditType } from "../constants/AuditType"; import { AuditType } from "../constants/AuditType";
import EmbedColours from "../constants/EmbedColours"; import EmbedColours from "../constants/EmbedColours";
import ErrorMessages from "../constants/ErrorMessages";
import { ICommandContext } from "../contracts/ICommandContext";
import Audit from "../entity/Audit"; import Audit from "../entity/Audit";
import SettingsHelper from "../helpers/SettingsHelper"; import SettingsHelper from "../helpers/SettingsHelper";
import { Command } from "../type/command"; import { Command } from "../type/command";

View file

@ -1,10 +1,7 @@
import { CommandInteraction, EmbedBuilder, GuildMemberRoleManager, Role as DiscordRole, SlashCommandBuilder } from "discord.js"; import { CommandInteraction, EmbedBuilder, GuildMemberRoleManager, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command"; import { Command } from "../type/command";
import { ICommandContext } from "../contracts/ICommandContext";
import SettingsHelper from "../helpers/SettingsHelper"; import SettingsHelper from "../helpers/SettingsHelper";
import { readFileSync } from "fs";
import { default as eRole } from "../entity/Role"; import { default as eRole } from "../entity/Role";
import Server from "../entity/Server";
import EmbedColours from "../constants/EmbedColours"; import EmbedColours from "../constants/EmbedColours";
export default class Role extends Command { export default class Role extends Command {

View file

@ -1,7 +1,6 @@
import { CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js"; import { CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { existsSync, readFileSync } from "fs"; import { existsSync, readFileSync } from "fs";
import EmbedColours from "../constants/EmbedColours"; import EmbedColours from "../constants/EmbedColours";
import { ICommandContext } from "../contracts/ICommandContext";
import { Command } from "../type/command"; import { Command } from "../type/command";
interface IRules { interface IRules {

View file

@ -1,5 +1,4 @@
import { CommandInteraction, SlashCommandBuilder } from "discord.js"; import { CommandInteraction, SlashCommandBuilder } from "discord.js";
import { ICommandContext } from "../contracts/ICommandContext";
import Server from "../entity/Server"; import Server from "../entity/Server";
import { Command } from "../type/command"; import { Command } from "../type/command";

View file

@ -1,9 +1,5 @@
import { CommandInteraction, EmbedBuilder, GuildMember, PermissionsBitField, SlashCommandBuilder, TextChannel } from "discord.js"; import { CommandInteraction, EmbedBuilder, GuildMember, PermissionsBitField, SlashCommandBuilder, TextChannel } from "discord.js";
import { AuditType } from "../constants/AuditType";
import EmbedColours from "../constants/EmbedColours"; import EmbedColours from "../constants/EmbedColours";
import ErrorMessages from "../constants/ErrorMessages";
import { ICommandContext } from "../contracts/ICommandContext";
import Audit from "../entity/Audit";
import SettingsHelper from "../helpers/SettingsHelper"; import SettingsHelper from "../helpers/SettingsHelper";
import { Command } from "../type/command"; import { Command } from "../type/command";

View file

@ -1,8 +1,6 @@
import { CommandInteraction, EmbedBuilder, GuildMember, PermissionsBitField, SlashCommandBuilder, TextChannel } from "discord.js"; import { CommandInteraction, EmbedBuilder, GuildMember, PermissionsBitField, SlashCommandBuilder, TextChannel } from "discord.js";
import { AuditType } from "../constants/AuditType"; import { AuditType } from "../constants/AuditType";
import EmbedColours from "../constants/EmbedColours"; import EmbedColours from "../constants/EmbedColours";
import ErrorMessages from "../constants/ErrorMessages";
import { ICommandContext } from "../contracts/ICommandContext";
import Audit from "../entity/Audit"; import Audit from "../entity/Audit";
import SettingsHelper from "../helpers/SettingsHelper"; import SettingsHelper from "../helpers/SettingsHelper";
import { Command } from "../type/command"; import { Command } from "../type/command";

View file

@ -1,7 +0,0 @@
import { Message } from "discord.js";
export interface ICommandContext {
name: string;
args: string[];
message: Message;
}

View file

@ -1,4 +1,4 @@
import { Column, Entity, getConnection, ManyToOne } from "typeorm"; import { Column, Entity, getConnection } from "typeorm";
import { AuditType } from "../constants/AuditType"; import { AuditType } from "../constants/AuditType";
import BaseEntity from "../contracts/BaseEntity"; import BaseEntity from "../contracts/BaseEntity";
import StringTools from "../helpers/StringTools"; import StringTools from "../helpers/StringTools";

View file

@ -1,4 +1,4 @@
import { Column, Entity, EntityTarget, getConnection, ManyToOne } from "typeorm"; import { Column, Entity, getConnection, ManyToOne } from "typeorm";
import BaseEntity from "../contracts/BaseEntity" import BaseEntity from "../contracts/BaseEntity"
import Server from "./Server"; import Server from "./Server";

View file

@ -1,5 +1,5 @@
import { Event } from "../type/event"; import { Event } from "../type/event";
import { EmbedBuilder, GuildChannel, GuildMember, TextChannel } from "discord.js"; import { EmbedBuilder, GuildMember, TextChannel } from "discord.js";
import GuildMemberUpdate from "./MemberEvents/GuildMemberUpdate"; import GuildMemberUpdate from "./MemberEvents/GuildMemberUpdate";
import SettingsHelper from "../helpers/SettingsHelper"; import SettingsHelper from "../helpers/SettingsHelper";
import EmbedColours from "../constants/EmbedColours"; import EmbedColours from "../constants/EmbedColours";

View file

@ -1,6 +1,5 @@
import { CommandResponse } from "../constants/CommandResponse"; import { CommandResponse } from "../constants/CommandResponse";
import { ICommandContext } from "../contracts/ICommandContext"; import { CommandInteraction } from "discord.js";
import { CommandInteraction, Interaction, SlashCommandBuilder } from "discord.js";
export class Command { export class Command {
public CommandBuilder: any; public CommandBuilder: any;