async logModerAction(text) {
    const loggingEnabled = await this.context.dbManager.getSetting(
      this.source,
      this.orgId,
      ServerSettingsTable.SERVER_SETTINGS.moderLogsEnabled.name,
      OhUtils.OFF
    );

    if (loggingEnabled === OhUtils.OFF) {
      return;
    }

    const channelId = await this.context.dbManager.getSetting(
      this.source,
      this.orgId,
      ServerSettingsTable.SERVER_SETTINGS.moderLogsChannel.name,
      null
    );

    const channelsManager = this.context.discordClient.guilds.cache.get(this.orgId).channels;
    const channelsCache = channelsManager.cache;

    let targetChannel = await channelsCache.find(channel =>
      channel.type === OrgChannel.getTextType() && channel.id === channelId);

    if (targetChannel === undefined) {
      targetChannel = await channelsCache.find(channel =>
        channel.type === OrgChannel.getTextType() && channel.name === DefaultLogChannel);
    }

    if (targetChannel === undefined) {
      try {
        await channelsManager.create(DefaultLogChannel, { type: OrgChannel.getTextType() });
      } catch (e) {
        this.context.log.e("Error creating text channel with name " + DefaultLogChannel + " for guild " + this.orgId +
          ' stack: ' + e.stack);
      }

      targetChannel = await channelsCache.find(channel =>
        channel.type === OrgChannel.getTextType() && channel.name === DefaultLogChannel);
    }

    if (targetChannel === undefined) {
      this.context.log.e("Cannot add moder logs: text channel " + DefaultLogChannel + " not found even" +
        " after trying to create it.");
    } else {
      await DiscordUtils.sendToTextChannel(targetChannel, text);
    }
  }
/**
   * Logs a text into the moderation logs channel (if applicable according to the server settings).
   * @param  {string}  text the text to be logged
   * @return {Promise}      nothing
   */
Logs a text into the moderation logs channel (if applicable according to the server settings).
@param  {string}  text the text to be logged
@return {Promise}      nothing
Logs a text into the moderation logs channel ( if applicable according to the server settings ) . @param { string } text the text to be logged @return { Promise } nothing
async logModerAction(text) {
    const loggingEnabled = await this.context.dbManager.getSetting(
      this.source,
      this.orgId,
      ServerSettingsTable.SERVER_SETTINGS.moderLogsEnabled.name,
      OhUtils.OFF
    );
    if (loggingEnabled === OhUtils.OFF) {
      return;
    }
    const channelId = await this.context.dbManager.getSetting(
      this.source,
      this.orgId,
      ServerSettingsTable.SERVER_SETTINGS.moderLogsChannel.name,
      null
    );
    const channelsManager = this.context.discordClient.guilds.cache.get(this.orgId).channels;
    const channelsCache = channelsManager.cache;
    let targetChannel = await channelsCache.find(channel =>
      channel.type === OrgChannel.getTextType() && channel.id === channelId);
    if (targetChannel === undefined) {
      targetChannel = await channelsCache.find(channel =>
        channel.type === OrgChannel.getTextType() && channel.name === DefaultLogChannel);
    }
    if (targetChannel === undefined) {
      try {
        await channelsManager.create(DefaultLogChannel, { type: OrgChannel.getTextType() });
      } catch (e) {
        this.context.log.e("Error creating text channel with name " + DefaultLogChannel + " for guild " + this.orgId +
          ' stack: ' + e.stack);
      }
      targetChannel = await channelsCache.find(channel =>
        channel.type === OrgChannel.getTextType() && channel.name === DefaultLogChannel);
    }
    if (targetChannel === undefined) {
      this.context.log.e("Cannot add moder logs: text channel " + DefaultLogChannel + " not found even" +
        " after trying to create it.");
    } else {
      await DiscordUtils.sendToTextChannel(targetChannel, text);
    }
  }
async logModerAction ( text ) { const loggingEnabled = await this . context . dbManager . getSetting ( this . source , this . orgId , ServerSettingsTable . SERVER_SETTINGS . moderLogsEnabled . name , OhUtils . OFF ) ; if ( loggingEnabled === OhUtils . OFF ) { return ; } const channelId = await this . context . dbManager . getSetting ( this . source , this . orgId , ServerSettingsTable . SERVER_SETTINGS . moderLogsChannel . name , null ) ; const channelsManager = this . context . discordClient . guilds . cache . get ( this . orgId ) . channels ; const channelsCache = channelsManager . cache ; let targetChannel = await channelsCache . find ( channel => channel . type === OrgChannel . getTextType ( ) && channel . id === channelId ) ; if ( targetChannel === undefined ) { targetChannel = await channelsCache . find ( channel => channel . type === OrgChannel . getTextType ( ) && channel . name === DefaultLogChannel ) ; } if ( targetChannel === undefined ) { try { await channelsManager . create ( DefaultLogChannel , { type : OrgChannel . getTextType ( ) } ) ; } catch ( e ) { this . context . log . e ( "Error creating text channel with name " + DefaultLogChannel + " for guild " + this . orgId + ' stack: ' + e . stack ) ; } targetChannel = await channelsCache . find ( channel => channel . type === OrgChannel . getTextType ( ) && channel . name === DefaultLogChannel ) ; } if ( targetChannel === undefined ) { this . context . log . e ( "Cannot add moder logs: text channel " + DefaultLogChannel + " not found even" + " after trying to create it." ) ; } else { await DiscordUtils . sendToTextChannel ( targetChannel , text ) ; } }
Logs a text into the moderation logs channel (if applicable according to the server settings).
Logs a text into the moderation logs channel ( if applicable according to the server settings ) .