Browse Source

Remove maintenance messages

ghorsington 5 years ago
parent
commit
9665d2ccff
2 changed files with 2 additions and 28 deletions
  1. 2 9
      src/main.ts
  2. 0 19
      src/util.ts

+ 2 - 9
src/main.ts

@@ -2,7 +2,6 @@ import * as dotenv from "dotenv";
 import * as fs from "fs";
 import * as path from "path";
 import client from "./client";
-import { shouldShowMaintenanceMessage, documentation } from "./util";
 import { ICommand, BotEvent, IBotCommand } from "./commands/command"
 import "reflect-metadata";
 import {createConnection} from "typeorm";
@@ -51,16 +50,11 @@ client.on("message", async m => {
 
     let content = m.cleanContent.trim();
 
-    if (!shouldShowMaintenanceMessage(m.guild.id) && await trigger(msgActions, m, content))
+    if (await trigger(msgActions, m, content))
         return;
 
     if (m.mentions.users.size > 0 && m.mentions.users.first().id == client.user.id) {
 
-        if(shouldShowMaintenanceMessage(m.guild.id)) {
-            m.channel.send(`${m.author.toString()} I'm currently being maintained; please wait.`);
-            return;
-        }
-
         if (content.startsWith(`@${client.user.username}`)) {
             content = content.substring(`@${client.user.username}`.length).trim();
 
@@ -87,8 +81,7 @@ client.on("message", async m => {
             return;
     }
 
-    if(!shouldShowMaintenanceMessage(m.guild.id))
-        await trigger(postActions);
+    await trigger(postActions);
 });
 
 client.on("messageReactionAdd", (r, u) => {

+ 0 - 19
src/util.ts

@@ -1,4 +1,3 @@
-import { db } from "./db"
 import { CollectionChain } from "lodash";
 import { GuildMember } from "discord.js";
 import { DocumentationSet } from "./commands/command";
@@ -18,14 +17,6 @@ export function isDevelopment() {
     return process.env.NODE_ENV == "dev";
 }
 
-export function shouldShowMaintenanceMessage(serverId : string) {
-    if(process.env.NODE_ENV != "dev")
-        return false;
-
-    let devServers = db.get("devServers") as CollectionChain<string>;
-    return !devServers.includes(serverId).value();
-}
-
 export function isValidImage(fileName: string) {
     let extPosition = fileName.lastIndexOf(".");
     if(extPosition < 0)
@@ -34,16 +25,6 @@ export function isValidImage(fileName: string) {
     return VALID_EXTENSIONS.has(ext);
 }
 
-export function isAuthorised(member : GuildMember) {
-    let users = db.get("editors.users") as CollectionChain<string>;
-    let roles = db.get("editors.roles") as CollectionChain<string>;
-    if (users.includes(member.id).value())
-        return true;
-    if (roles.intersectionWith(member.roles.keyArray()).isEmpty().value())
-        return false;
-    return true;
-}
-
 export async function isAuthorisedAsync(member : GuildMember) {
     let repo = getRepository(KnownUser);