<commit_before>"""This is the main instance that does all the command processing.
Please run this file to run the actual bot itself"""
import errno
import os
import sqlite3 as lite
import sys
import time
import asyncio
from datetime import datetime

import discord  # Discord API
from discord.ext import commands
from lib import obot

bot = commands.Bot(command_prefix=commands.when_mentioned_or(obot.bot_prefix),
                   owner_id=obot.owner_id)
bot.launch_time = datetime.utcnow()

timer_start = time.time()

DIR_MAKE = ["important"]
for i in DIR_MAKE:
    try:
        os.makedirs(i)
    except OSError as err:
        if err.errno != errno.EEXIST:
            raise

NODE_MAKE = ["important/serverdata.db", "important/userdata.db"]
for i in NODE_MAKE:
    if not os.path.exists(i):
        with open(i, 'w'):
            pass

@bot.event
async def on_ready():
    timer_end = time.time()
    print("Launching of bot took {} seconds".format(timer_start - timer_end))
    await bot.change_presence(activity=discord.Game(type=obot.gametype, name=obot.game),
                              status=discord.Status.online)
    servers = len(bot.guilds)
    users = len(bot.users)
    print(f"Serving {users} users in " + str(servers) +
          " server" + ("s" if servers > 1 else "") + ".")

    # reminder routine
    con = lite.connect("important/data.db")
    while True:
        with con:
            try:
                cur = con.cursor()
                cur.execute("SELECT * FROM Reminders WHERE DATE('now') - remind_time >= 0;")
                rows = cur.fetchall()
                for i in rows:
                    target_user = bot.get_user(i[3])
                    await target_user.send((f"Hello! You've asked me to remind you about something just now"
                                            f"Included message: `{i[0]}`"
                                            f"Message where request was made: <{i[1]}>"))
            except lite.OperationalError as err:
                if str(err) == "no such table: Reminders":
                    cur.execute(
                        ("CREATE TABLE Reminders(message TEXT NOT NULL, "<commit_msg>delete the entries when we've ran through them<commit_after>"""This is the main instance that does all the command processing.
Please run this file to run the actual bot itself"""
import errno
import os
import sqlite3 as lite
import sys
import time
import asyncio
from datetime import datetime

import discord  # Discord API
from discord.ext import commands
from lib import obot

bot = commands.Bot(command_prefix=commands.when_mentioned_or(obot.bot_prefix),
                   owner_id=obot.owner_id)
bot.launch_time = datetime.utcnow()

timer_start = time.time()

DIR_MAKE = ["important"]
for i in DIR_MAKE:
    try:
        os.makedirs(i)
    except OSError as err:
        if err.errno != errno.EEXIST:
            raise

NODE_MAKE = ["important/serverdata.db", "important/userdata.db"]
for i in NODE_MAKE:
    if not os.path.exists(i):
        with open(i, 'w'):
            pass

@bot.event
async def on_ready():
    timer_end = time.time()
    print("Launching of bot took {} seconds".format(timer_start - timer_end))
    await bot.change_presence(activity=discord.Game(type=obot.gametype, name=obot.game),
                              status=discord.Status.online)
    servers = len(bot.guilds)
    users = len(bot.users)
    print(f"Serving {users} users in " + str(servers) +
          " server" + ("s" if servers > 1 else "") + ".")

    # reminder routine
    con = lite.connect("important/data.db")
    while True:
        with con:
            try:
                cur = con.cursor()
                cur.execute("SELECT * FROM Reminders WHERE DATE('now') - remind_time >= 0;")
                rows = cur.fetchall()
                for i in rows:
                    target_user = bot.get_user(i[3])
                    await target_user.send((f"Hello! You've asked me to remind you about something just now"
                                            f"Included message: `{i[0]}`"
                                            f"Message where request was made: <{i[1]}>"))
                cur.execute("DELETE * FROM Reminders WHERE DATE('now') - remind_time >= 0;")
                print(cur.fetchall())
            except lite.OperationalError as err:
                if str(err) == "no such table: Reminders":
                    cur.execute(
                        ("CREATE TABLE Reminders(message TEXT NOT NULL, "
{'fraction_non_alphanumeric': 0.10444444444444445, 'fraction_numerical': 0.0028888888888888888, 'mean_word_length': 2.0871056241426613, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1114732', 'n_tokens_mistral': 1333, 'n_tokens_neox': 1279, 'n_words': 381}