Skip to content

Commit

Permalink
rework: slash commands and components
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciborn committed Mar 27, 2022
1 parent 3fd28cb commit cd07022
Show file tree
Hide file tree
Showing 173 changed files with 1,658 additions and 1,431 deletions.
Empty file modified .dockerignore
100644 → 100755
Empty file.
1 change: 0 additions & 1 deletion .env.example
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ API_OMDB=
API_OSU=
API_PEXELS=
API_TENOR=
API_YANDEX=

MYSQL_HOST=
MYSQL_USER=
Expand Down
Empty file modified .eslintrc
100644 → 100755
Empty file.
Empty file modified .github/ISSUE_TEMPLATE/bug_report.md
100644 → 100755
Empty file.
Empty file modified .github/ISSUE_TEMPLATE/feature_request.md
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified Dockerfile
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified assets/data/actiontext.json
100644 → 100755
Empty file.
Empty file modified assets/data/aldebaranPermissions.json
100644 → 100755
Empty file.
Empty file modified assets/data/categories.json
100644 → 100755
Empty file.
Empty file modified assets/data/drpg/bases.json
100644 → 100755
Empty file.
Empty file modified assets/data/drpg/itemList.json
100644 → 100755
Empty file.
Empty file modified assets/data/drpg/locations.json
100644 → 100755
Empty file.
Empty file modified assets/data/drpgbasexp.json
100644 → 100755
Empty file.
Empty file modified assets/data/drpgquestinfo.json
100644 → 100755
Empty file.
Empty file modified assets/data/imageurls.json
100644 → 100755
Empty file.
Empty file modified assets/data/staffRoles.json
100644 → 100755
Empty file.
Empty file modified assets/data/variables.json
100644 → 100755
Empty file.
Empty file modified assets/emojis/fish.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/emojis/leaves.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/emojis/pickaxe.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/emojis/tree.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/fonts/Exo2-Regular.ttf
100644 → 100755
Empty file.
Empty file modified assets/locales/en.json
100644 → 100755
Empty file.
Empty file modified assets/locales/fr.json
100644 → 100755
Empty file.
Empty file modified config/aldebaranTeam.json
100644 → 100755
Empty file.
Empty file modified config/presence.json
100644 → 100755
Empty file.
Empty file modified docker-compose.yml
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aldebaran",
"version": "3.1.0",
"version": "3.2.0",
"description": "Utility",
"main": "src/app.ts",
"dependencies": {
Expand Down
Empty file modified src/api/api.ts
100644 → 100755
Empty file.
Empty file modified src/api/graphql/schema.graphql
100644 → 100755
Empty file.
Empty file modified src/api/graphql/types/PageInfo.ts
100644 → 100755
Empty file.
Empty file modified src/api/graphql/types/SocialProfile.ts
100644 → 100755
Empty file.
Empty file modified src/api/graphql/types/common/DiscordStructWithSettings.ts
100644 → 100755
Empty file.
Empty file modified src/api/graphql/types/guild/Guild.ts
100644 → 100755
Empty file.
Empty file modified src/api/graphql/types/guild/GuildsConnection.ts
100644 → 100755
Empty file.
Empty file modified src/api/graphql/types/guild/GuildsConnectionEdge.ts
100644 → 100755
Empty file.
Empty file modified src/api/graphql/types/user/User.ts
100644 → 100755
Empty file.
Empty file modified src/api/graphql/types/user/UsersConnection.ts
100644 → 100755
Empty file.
Empty file modified src/api/graphql/types/user/UsersConnectionEdge.ts
100644 → 100755
Empty file.
Empty file modified src/api/graphql/utils/fetchDBValue.ts
100644 → 100755
Empty file.
Empty file modified src/api/graphql/utils/fetchDSMValue.ts
100644 → 100755
Empty file.
Empty file modified src/api/interfaces/OAuth2Client.ts
100644 → 100755
Empty file.
Empty file modified src/api/middlewares/oauth2/model.ts
100644 → 100755
Empty file.
Empty file modified src/api/public/css/style.css
100644 → 100755
Empty file.
Empty file modified src/api/public/img/alde.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified src/api/public/img/aldebg.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified src/api/routes/discord/callback.ts
100644 → 100755
Empty file.
Empty file modified src/api/routes/oauth/authorize.ts
100644 → 100755
Empty file.
Empty file modified src/api/routes/oauth/token.ts
100644 → 100755
Empty file.
Empty file modified src/api/util/Constants.ts
100644 → 100755
Empty file.
Empty file modified src/api/util/validateSession.ts
100644 → 100755
Empty file.
Empty file modified src/api/views/authorize.pug
100644 → 100755
Empty file.
Empty file modified src/bot.ts
100644 → 100755
Empty file.
23 changes: 12 additions & 11 deletions src/commands/commands.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import CommandHandler from "../handlers/CommandHandler.js";
import DiscordMessageContext from "../structures/contexts/DiscordMessageContext.js";
import AldebaranClient from "../structures/djs/Client.js";
import { Platform } from "../utils/Constants.js";
import executeSocial from "../utils/executeSocial.js";

// Developer
Expand Down Expand Up @@ -49,7 +51,6 @@ import UserCommand from "./general/user.js";
import BirbCommand from "./image/birb.js";
import BunnyCommand from "./image/bunny.js";
import CatCommand from "./image/cat.js";
import CuteagCommand from "./image/cuteag.js";
import DogCommand from "./image/dog.js";
import DuckCommand from "./image/duck.js";
import HedgehogCommand from "./image/hedgehog.js";
Expand All @@ -58,6 +59,7 @@ import NekoCommand from "./image/neko.js";
import PandaCommand from "./image/panda.js";
import PepeCommand from "./image/pepe.js";
import RandimalCommand from "./image/randimal.js";
import RCGPCommand from "./image/rcgp.js";

// NSFW
import LewdCommand from "./nsfw/lewd.js";
Expand Down Expand Up @@ -87,8 +89,6 @@ import TickleCommand from "./social/tickle.js";
// Utilities
import CurconvCommand from "./utilities/curconv.js";
import MathCommand from "./utilities/math.js";
import TranslateCommand from "./utilities/translate.js";
import MessageContext from "../structures/aldebaran/MessageContext.js";

export default () => {
const commandHandler = CommandHandler.getInstance();
Expand Down Expand Up @@ -116,13 +116,18 @@ export default () => {
super(client, {
name,
description,
args: { user: { as: "user" } }
args: { user: {
as: "user",
desc: "The user you want to socialize with",
optional: true
} },
platforms: ["DISCORD"]
});
}

// eslint-disable-next-line class-methods-use-this
run(ctx: MessageContext) {
executeSocial(ctx);
run(ctx: DiscordMessageContext, platform: Platform) {
executeSocial(ctx, platform);
}
});
}
Expand All @@ -149,11 +154,11 @@ export default () => {
TimeCommand,
UserCommand,
BirbCommand,
CuteagCommand,
DogCommand,
LizardCommand,
NekoCommand,
PandaCommand,
RCGPCommand,
LewdCommand,
XboobsCommand,
XkittyCommand,
Expand Down Expand Up @@ -224,8 +229,4 @@ export default () => {
if (process.env.API_FIXER) {
commandHandler.register(CurconvCommand);
}

if (process.env.API_YANDEX) {
commandHandler.register(TranslateCommand);
}
};
11 changes: 4 additions & 7 deletions src/commands/developer/admin.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MessageEmbed } from "discord.js";
import MessageContext from "../../structures/aldebaran/MessageContext.js";
import MessageContext from "../../structures/contexts/MessageContext.js";
import { Command } from "../../groups/DeveloperCommand.js";
import AldebaranClient from "../../structures/djs/Client.js";

Expand All @@ -14,8 +14,8 @@ export default class AdminCommand extends Command {
constructor(client: AldebaranClient) {
super(client, {
description: "Admin Portal Command",
allowIndexCommand: true,
perms: { aldebaran: ["EDIT_USERS"] }
perms: { aldebaran: ["EDIT_USERS"] },
platforms: ["DISCORD"]
});
this.registerSubcommands(
mod,
Expand All @@ -30,10 +30,7 @@ export default class AdminCommand extends Command {
// eslint-disable-next-line class-methods-use-this
async run(ctx: MessageContext) {
const embed = new MessageEmbed()
.setAuthor(
ctx.message.author.username,
ctx.message.author.displayAvatarURL()
)
.setAuthor(ctx.author.username, ctx.author.avatarURL)
.setTitle("Warning")
.setDescription("The admin action specified is invalid.")
.setColor("ORANGE");
Expand Down
26 changes: 13 additions & 13 deletions src/commands/developer/admin/mod.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MessageEmbed } from "discord.js";
import MessageContext from "../../../structures/aldebaran/MessageContext.js";
import MessageContext from "../../../structures/contexts/MessageContext.js";
import { Command } from "../../../groups/DeveloperCommand.js";
import AldebaranClient from "../../../structures/djs/Client.js";
import { SettingsModel, GuildSetting, UserSetting } from "../../../utils/Constants.js";
Expand All @@ -25,8 +25,8 @@ export default class ModSubcommand extends Command {
await user.changeSetting(args[1] as UserSetting, args[2]);
const embed = new MessageEmbed()
.setAuthor(
ctx.message.author.username,
ctx.message.author.displayAvatarURL()
ctx.author.username,
ctx.author.avatarURL
)
.setTitle("Changes Done")
.setDescription("The changes have successfully been applied. Please note that this command does not check for valid properties/values, make sure the user modded has the correct settings.")
Expand All @@ -38,8 +38,8 @@ export default class ModSubcommand extends Command {
await guild.changeSetting(args[1] as GuildSetting, args[2]);
const embed = new MessageEmbed()
.setAuthor(
ctx.message.author.username,
ctx.message.author.displayAvatarURL()
ctx.author.username,
ctx.author.avatarURL
)
.setTitle("Changes Done")
.setDescription("The changes have successfully been applied. Please note that this command does not check for valid properties/values, make sure the guild modded has the correct settings.")
Expand All @@ -48,8 +48,8 @@ export default class ModSubcommand extends Command {
} else {
const embed = new MessageEmbed()
.setAuthor(
ctx.message.author.username,
ctx.message.author.displayAvatarURL()
ctx.author.username,
ctx.author.avatarURL
)
.setTitle("Warning")
.setDescription(`The ID specified does not correspond to a valid user or a guild where ${ctx.client.user!.username} is.`)
Expand All @@ -60,8 +60,8 @@ export default class ModSubcommand extends Command {
} else {
const embed = new MessageEmbed()
.setAuthor(
ctx.message.author.username,
ctx.message.author.displayAvatarURL()
ctx.author.username,
ctx.author.avatarURL
)
.setTitle("Warning")
.setDescription("You need to specify the value of the settings you want to change.")
Expand All @@ -71,8 +71,8 @@ export default class ModSubcommand extends Command {
} else {
const embed = new MessageEmbed()
.setAuthor(
ctx.message.author.username,
ctx.message.author.displayAvatarURL()
ctx.author.username,
ctx.author.avatarURL
)
.setTitle("Warning")
.setDescription("You need to specify the property of the settings you want to change.")
Expand All @@ -82,8 +82,8 @@ export default class ModSubcommand extends Command {
} else {
const embed = new MessageEmbed()
.setAuthor(
ctx.message.author.username,
ctx.message.author.displayAvatarURL()
ctx.author.username,
ctx.author.avatarURL
)
.setTitle("Warning")
.setDescription("You need to specify the ID of the user or the guild you want to change the settings of.")
Expand Down
2 changes: 1 addition & 1 deletion src/commands/developer/admin/restart.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MessageEmbed } from "discord.js";
import MessageContext from "../../../structures/aldebaran/MessageContext.js";
import MessageContext from "../../../structures/contexts/MessageContext.js";
import { Command } from "../../../groups/DeveloperCommand.js";
import AldebaranClient from "../../../structures/djs/Client.js";

Expand Down
8 changes: 5 additions & 3 deletions src/commands/developer/admin/serverlist.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { Collection, Guild, Snowflake } from "discord.js";
import MessageContext from "../../../structures/aldebaran/MessageContext.js";
import { Command, Embed } from "../../../groups/DeveloperCommand.js";
import AldebaranClient from "../../../structures/djs/Client.js";
import { paginate } from "../../../utils/Methods.js";
import DiscordMessageContext from "../../../structures/contexts/DiscordMessageContext.js";
import DiscordSlashMessageContext from "../../../structures/contexts/DiscordSlashMessageContext.js";

export default class ServerlistSubcommand extends Command {
constructor(client: AldebaranClient) {
super(client, {
description: "Lists the servers the bot is in",
perms: { aldebaran: ["VIEW_SERVERLIST"] }
perms: { aldebaran: ["VIEW_SERVERLIST"] },
platforms: ["DISCORD", "DISCORD_SLASH"]
});
}

// eslint-disable-next-line class-methods-use-this
async run(ctx: MessageContext) {
async run(ctx: DiscordMessageContext | DiscordSlashMessageContext) {
const list: string[] = [];
ctx.client.shard!.fetchClientValues("guilds.cache").then(collected => {
(collected as Collection<Snowflake, Guild>[])
Expand Down
34 changes: 17 additions & 17 deletions src/commands/developer/admin/setperm.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MessageEmbed } from "discord.js";
import MessageContext from "../../../structures/aldebaran/MessageContext.js";
import MessageContext from "../../../structures/contexts/MessageContext.js";
import { PermissionString } from "../../../utils/Constants.js";
import { Command } from "../../../groups/DeveloperCommand.js";
import AldebaranPermissions from "../../../structures/aldebaran/AldebaranPermissions.js";
Expand All @@ -19,8 +19,8 @@ export default class SetpermSubcommand extends Command {
if (args[0] === undefined) {
const embed = new MessageEmbed()
.setAuthor(
ctx.message.author.username,
ctx.message.author.displayAvatarURL()
ctx.author.username,
ctx.author.avatarURL
)
.setTitle("Warning")
.setDescription("You need to specify the ID of the user you want to change the permissions of.")
Expand All @@ -30,8 +30,8 @@ export default class SetpermSubcommand extends Command {
if (args[1] === undefined) {
const embed = new MessageEmbed()
.setAuthor(
ctx.message.author.username,
ctx.message.author.displayAvatarURL()
ctx.author.username,
ctx.author.avatarURL
)
.setTitle("Warning")
.setDescription("You need to specify the operation you want to perform (ADD or REMOVE)")
Expand All @@ -41,8 +41,8 @@ export default class SetpermSubcommand extends Command {
if (args[1].toLowerCase() !== "add" && args[1].toLowerCase() !== "remove") {
const embed = new MessageEmbed()
.setAuthor(
ctx.message.author.username,
ctx.message.author.displayAvatarURL()
ctx.author.username,
ctx.author.avatarURL
)
.setTitle("Warning")
.setDescription("You need to specify either ADD or REMOVE as the operation.")
Expand All @@ -52,8 +52,8 @@ export default class SetpermSubcommand extends Command {
if (args[2] === undefined) {
const embed = new MessageEmbed()
.setAuthor(
ctx.message.author.username,
ctx.message.author.displayAvatarURL()
ctx.author.username,
ctx.author.avatarURL
)
.setTitle("Warning")
.setDescription(`You need to specify the ${ctx.client.name} permissions you want to set (seperated by spaces). (See \`assets/data/aldebaranPermissions.json\` for valid flags.)`)
Expand All @@ -66,8 +66,8 @@ export default class SetpermSubcommand extends Command {
.includes(permission)) as PermissionString[];
const embedFailure = (error: Error) => new MessageEmbed()
.setAuthor(
ctx.message.author.username,
ctx.message.author.displayAvatarURL()
ctx.author.username,
ctx.author.avatarURL
)
.setTitle("Warning")
.setDescription(`Something went wrong: \n\`${error}\``)
Expand All @@ -78,8 +78,8 @@ export default class SetpermSubcommand extends Command {
await user.addPermissions(permissions);
const embedAddSuccess = new MessageEmbed()
.setAuthor(
ctx.message.author.username,
ctx.message.author.displayAvatarURL()
ctx.author.username,
ctx.author.avatarURL
)
.setTitle("Success")
.setDescription(`Successfully added:\n\`${permissions.join(", ")}\`\n to ${user.username}.`)
Expand All @@ -95,8 +95,8 @@ export default class SetpermSubcommand extends Command {
await user.removePermissions(permissions);
const embedRemoveSuccess = new MessageEmbed()
.setAuthor(
ctx.message.author.username,
ctx.message.author.displayAvatarURL()
ctx.author.username,
ctx.author.avatarURL
)
.setTitle("Success")
.setDescription(`Successfully removed:\n\`${permissions.join(", ")}\`\n from ${user.username}.`)
Expand All @@ -113,8 +113,8 @@ export default class SetpermSubcommand extends Command {
}).catch(() => {
const embed = new MessageEmbed()
.setAuthor(
ctx.message.author.username,
ctx.message.author.displayAvatarURL()
ctx.author.username,
ctx.author.avatarURL
)
.setTitle("Warning")
.setDescription("The ID specified does not correspond to a valid user.")
Expand Down
12 changes: 6 additions & 6 deletions src/commands/developer/admin/timeout.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MessageEmbed } from "discord.js";
import MessageContext from "../../../structures/aldebaran/MessageContext.js";
import MessageContext from "../../../structures/contexts/MessageContext.js";
import { Command } from "../../../groups/DeveloperCommand.js";
import AldebaranClient from "../../../structures/djs/Client.js";

Expand Down Expand Up @@ -33,7 +33,7 @@ export default class TimeoutSubcommand extends Command {
.addField("Reason", args.join(" "), true)
.addField("Server Invite", "https://discord.gg/3x6rXAv", true)
.setColor("RED")
.setFooter(`Action taken by ${ctx.message.author.tag}`, ctx.message.author.displayAvatarURL());
.setFooter(`Action taken by ${ctx.author.user.tag}`, ctx.author.avatarURL);
user.user.send({ embeds: [embed] });
}).catch((err: Error) => {
console.error(err);
Expand All @@ -46,8 +46,8 @@ export default class TimeoutSubcommand extends Command {
.setDescription("This ID does not correspond to any Discord user. Make sure you did not make a mistake typing it.")
.setColor("RED")
.setFooter(
ctx.message.author.username,
ctx.message.author.displayAvatarURL()
ctx.author.username,
ctx.author.avatarURL
);
ctx.reply(embed);
});
Expand All @@ -57,8 +57,8 @@ export default class TimeoutSubcommand extends Command {
.setDescription("This command requires three arguments in order to work, the user to timeout, the length and the reason of it.")
.setColor("RED")
.setFooter(
ctx.message.author.username,
ctx.message.author.displayAvatarURL()
ctx.author.username,
ctx.author.avatarURL
);
ctx.reply(embed);
}
Expand Down
Loading

0 comments on commit cd07022

Please sign in to comment.