Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions server/src/API/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ export default class API {
public start(): void {
this.server = express();
this.server.use(express.json());
this.server.use(cors({
credentials: true,
origin: ["https://matrixdev.xyz", "https://stone.cssudii.tk"]
}));
//this.server.use(cors({
// credentials: true,
//origin: ["https://matrixdev.xyz", "https://stone.cssudii.tk"]
//}));

new GuildRouter(this.server, this.client);
new MemberRouter(this.server, this.client);
Expand Down
38 changes: 38 additions & 0 deletions server/src/commands/private/Update.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Message } from "discord.js";

import Command from "../../structures/Command";
import MatrixClient from "../../client/Client";
import { exec } from "child_process";

import { configOptions } from "../../client/Config";

export default class UpdateCommand extends Command {
constructor() {
super("update", {
categoryID: "Private",
channel: "all",
cooldown: 5,
description: "Updates the bot from github",
disabled: false,
examples: ["update"],
exceptions: {
ignoreCooldown: configOptions.owners,
ignorePermissions: configOptions.owners
},
permissions: {
clientPermissions: ["SEND_MESSAGES", "USE_EXTERNAL_EMOJIS", "EMBED_LINKS", "MANAGE_MESSAGES"],
userPermissions: ["SEND_MESSAGES"]
},
ownerOnly: true,
usage: "update"
});
};

public async exec(client: MatrixClient, message: Message, args: string[], Discord: typeof import("discord.js")): Promise<void> {
exec("cd .. && cd .. && cd .. && cd .. && git pull", (error, stdout, stderr) => {
// Chnage messages to embeds if you want
if (error) return message.channel.send("Failed to update from github!");
return message.channel.send(stdout);
});
};
};