async premoderateDiscordMessage(message) {
    const censoringEnabled = await this.context.dbManager.getSetting(
      message.source.name,
      message.orgId,
      ServerSettingsTable.SERVER_SETTINGS.censoring.name,
      OhUtils.OFF
    );

    if (censoringEnabled === OhUtils.ON) {
      const badWordsString = await this.context.dbManager.getSetting(
        message.source.name,
        message.orgId,
        ServerSettingsTable.SERVER_SETTINGS.badwords.name,
        ''
      );

      if (badWordsString.length > 0) {
        const badWords = badWordsString.split(ArrayArgScanner.ARRAY_SEPARATOR);
        let content = message.content.slice(0);
        for (const badWord of badWords) {
          const euphemism = OhUtils.makeEuphemism(badWord.length);
          const re = new RegExp(badWord, 'gi');

          content = content.replace(re, euphemism);
        }

        if (content !== message.content) {
          await message.reply(
            this.context.langManager.getString(
              'moderator_censored_message',
              DiscordUtils.makeUserMention(message.userId),
              content
            )
          );
          await message.originalMessage.delete();
        }
      }
    }
  }
/**
   * Premoderates incoming message (e.g. replaces bad words etc.)
   * @param  {BaseMessage}  message the Discordmessage
   * @return {Promise}              nothing
   */
Premoderates incoming message
@param  {BaseMessage}  message the Discordmessage
@return {Promise}              nothing
Premoderates incoming message @param { BaseMessage } message the Discordmessage @return { Promise } nothing
async premoderateDiscordMessage(message) {
    const censoringEnabled = await this.context.dbManager.getSetting(
      message.source.name,
      message.orgId,
      ServerSettingsTable.SERVER_SETTINGS.censoring.name,
      OhUtils.OFF
    );
    if (censoringEnabled === OhUtils.ON) {
      const badWordsString = await this.context.dbManager.getSetting(
        message.source.name,
        message.orgId,
        ServerSettingsTable.SERVER_SETTINGS.badwords.name,
        ''
      );
      if (badWordsString.length > 0) {
        const badWords = badWordsString.split(ArrayArgScanner.ARRAY_SEPARATOR);
        let content = message.content.slice(0);
        for (const badWord of badWords) {
          const euphemism = OhUtils.makeEuphemism(badWord.length);
          const re = new RegExp(badWord, 'gi');
          content = content.replace(re, euphemism);
        }
        if (content !== message.content) {
          await message.reply(
            this.context.langManager.getString(
              'moderator_censored_message',
              DiscordUtils.makeUserMention(message.userId),
              content
            )
          );
          await message.originalMessage.delete();
        }
      }
    }
  }
async premoderateDiscordMessage ( message ) { const censoringEnabled = await this . context . dbManager . getSetting ( message . source . name , message . orgId , ServerSettingsTable . SERVER_SETTINGS . censoring . name , OhUtils . OFF ) ; if ( censoringEnabled === OhUtils . ON ) { const badWordsString = await this . context . dbManager . getSetting ( message . source . name , message . orgId , ServerSettingsTable . SERVER_SETTINGS . badwords . name , '' ) ; if ( badWordsString . length > 0 ) { const badWords = badWordsString . split ( ArrayArgScanner . ARRAY_SEPARATOR ) ; let content = message . content . slice ( 0 ) ; for ( const badWord of badWords ) { const euphemism = OhUtils . makeEuphemism ( badWord . length ) ; const re = new RegExp ( badWord , 'gi' ) ; content = content . replace ( re , euphemism ) ; } if ( content !== message . content ) { await message . reply ( this . context . langManager . getString ( 'moderator_censored_message' , DiscordUtils . makeUserMention ( message . userId ) , content ) ) ; await message . originalMessage . delete ( ) ; } } } }
Premoderates incoming message (e.g.
Premoderates incoming message ( e . g .