<commit_before>const Discord = require('discord.js');
const init = require('./init.json');
const Server = require('./classes/Server.js');
const midnightTask = require('./classes/MidnightTask.js');
const hourlyTask = require('./classes/HourlyTask.js');
const lineNotify = require('./eventProcessors/notifyLINE');
let cmds = require('./cmds.js');
const commands = cmds.commands;
const inits = cmds.inits;
const prcs = require('./prcs.js');

const ciriIntents = new Discord.Intents(Discord.Intents.ALL);
ciriIntents.remove('GUILD_MESSAGE_TYPING', 'DIRECT_MESSAGE_TYPING');

// Set up Discord client settings.
// Note: Disabling other events such as user update tends to break everything.
const bot = new Discord.Client({
  disableMentions: 'everyone',
  ws: { intents: ciriIntents },
});

// Load initial configurations.
const token = init.token;
bot.owner_ID = init.owner_ID;

let time = new Date();
let h = time.getUTCHours();
let m = time.getUTCMinutes();
let s = time.getUTCSeconds();
let timeLeft = 24 * 60 * 60 - h * 60 * 60 - m * 60 - s;
bot.setTimeout(() => {
  // Set up the day changing task
  midnightTask(bot);
}, timeLeft * 1000); // Time left until the next day

bot.setTimeout(() => {
  // Set up hourly task
  hourlyTask(bot);
  bot.setInterval(() => {
    hourlyTask(bot);
  }, 60 * 60 * 1000);
}, ((60 - m) * 60 - s + 1) * 1000); // one second more

bot.on('ready', () => {
  console.log('Logged in as ' + bot.user.username);
  console.log(`${time.toLocaleDateString()} ${time.toLocaleTimeString()}`);
  console.log('--------------------------');
  // Initialize the bot and servers.
  bot.servers = {};
  bot.usableEmotes = [];
  for (let guild of bot.guilds.cache.values()) {
    if (guild.id == '293787390710120449') continue;
    bot.servers[guild.id] = new Server(guild, inits, prcs);
  }
  let helps = [',help', ',h', ',halp', ',tasukete'];
  bot.user.setActivity(helps[Math.floor(Math.random() * helps.length)], {
    type: 'LISTENING',
  });
});

bot.on('message', async (message) => {
  if (message.author.bot || message.system) {
    // Cirilla pinging Active staff
    if (
      message.author.id === '<PASSWORD>' &&
      message.content.includes('240647591770062848')
    ) {
      if (lineNotify.isAllowed(message, bot.servers[message.guild.id], bot)) {
        lineNotify.process(message, bot.servers[message.guild.id], bot);
      }
    }
    return;
  } // Ignore messages by bots and system
  if (message.channel.type === 'dm') {
    // Direct message.
    // EJLX user
    const ejlxMember = bot.servers[
      '189571157446492161'
    ].guild.members.cache.get(message.author.id);
    if (ejlxMember) {
      // Check for stage role
      if (ejlxMember.roles.cache.has('645021058184773643')) {
        if (message.content.toLowerCase().includes('potato')) {
          ejlxMember.roles.remove('645021058184773643');<commit_msg>confirmation message<commit_after>const Discord = require('discord.js');
const init = require('./init.json');
const Server = require('./classes/Server.js');
const midnightTask = require('./classes/MidnightTask.js');
const hourlyTask = require('./classes/HourlyTask.js');
const lineNotify = require('./eventProcessors/notifyLINE');
let cmds = require('./cmds.js');
const commands = cmds.commands;
const inits = cmds.inits;
const prcs = require('./prcs.js');

const ciriIntents = new Discord.Intents(Discord.Intents.ALL);
ciriIntents.remove('GUILD_MESSAGE_TYPING', 'DIRECT_MESSAGE_TYPING');

// Set up Discord client settings.
// Note: Disabling other events such as user update tends to break everything.
const bot = new Discord.Client({
  disableMentions: 'everyone',
  ws: { intents: ciriIntents },
});

// Load initial configurations.
const token = init.token;
bot.owner_ID = init.owner_ID;

let time = new Date();
let h = time.getUTCHours();
let m = time.getUTCMinutes();
let s = time.getUTCSeconds();
let timeLeft = 24 * 60 * 60 - h * 60 * 60 - m * 60 - s;
bot.setTimeout(() => {
  // Set up the day changing task
  midnightTask(bot);
}, timeLeft * 1000); // Time left until the next day

bot.setTimeout(() => {
  // Set up hourly task
  hourlyTask(bot);
  bot.setInterval(() => {
    hourlyTask(bot);
  }, 60 * 60 * 1000);
}, ((60 - m) * 60 - s + 1) * 1000); // one second more

bot.on('ready', () => {
  console.log('Logged in as ' + bot.user.username);
  console.log(`${time.toLocaleDateString()} ${time.toLocaleTimeString()}`);
  console.log('--------------------------');
  // Initialize the bot and servers.
  bot.servers = {};
  bot.usableEmotes = [];
  for (let guild of bot.guilds.cache.values()) {
    if (guild.id == '293787390710120449') continue;
    bot.servers[guild.id] = new Server(guild, inits, prcs);
  }
  let helps = [',help', ',h', ',halp', ',tasukete'];
  bot.user.setActivity(helps[Math.floor(Math.random() * helps.length)], {
    type: 'LISTENING',
  });
});

bot.on('message', async (message) => {
  if (message.author.bot || message.system) {
    // Cirilla pinging Active staff
    if (
      message.author.id === '5<PASSWORD>' &&
      message.content.includes('240647591770062848')
    ) {
      if (lineNotify.isAllowed(message, bot.servers[message.guild.id], bot)) {
        lineNotify.process(message, bot.servers[message.guild.id], bot);
      }
    }
    return;
  } // Ignore messages by bots and system
  if (message.channel.type === 'dm') {
    // Direct message.
    // EJLX user
    const ejlxMember = bot.servers[
      '189571157446492161'
    ].guild.members.cache.get(message.author.id);
    if (ejlxMember) {
      // Check for stage role
      if (ejlxMember.roles.cache.has('645021058184773643')) {
        if (message.content.toLowerCase().includes('potato')) {
          ejlxMember.roles.remove('645021058184773643');
          respondDM(
            message,
            'Thanks for reading the rules! You can now head over to <#189571157446492161> and state your native language.'
          );
{'fraction_non_alphanumeric': 0.1740527740189445, 'fraction_numerical': 0.04482408660351827, 'mean_word_length': 3.3382245047688923, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '541124', 'n_tokens_mistral': 2141, 'n_tokens_neox': 1966, 'n_words': 459}