<commit_before>import BotpySE as bp
import chatexchange as ce
from HalflifeListener import *
from DeepSmokeListener import *
from CommandUpdate import *
from Notifications import *
from Tagging import *
from commands import *

import os
import subprocess

class Pulse:
    def __init__ (self, nick, email, password, rooms):
        commands = default_commands
        commands.extend([
            CommandUpdate,
            CommandNotifications,
            CommandNotify,
            CommandUnnotify,
            CommandListTags,
            CommandAddTag,
            CommandRemoveTag 
            ])

        self._bot_header = '[ [PulseMonitor](https://github.com/Charcoal-SE/PulseMonitor) ]'

        bot = bp.Bot(nick, commands, rooms, [], "stackexchange.com", email, password)

        try:
            with open(bot._storage_prefix + 'redunda_key.txt', 'r') as file_handle:
                key = file_handle.readlines()[0].rstrip('\n')
            bot.set_redunda_key(key)
        except IOError as ioerr:
            print(str(ioerr))
            print("Bot is not integrated with Redunda.")

        bot.add_file_to_sync({"name": bot._storage_prefix + 'notifications.json', "ispickle": False, "at_home": False})
        bot.add_file_to_sync({"name": bot._storage_prefix + 'tags.json', "ispickle": False, "at_home": False})
        bot.redunda_init(bot_version=self._get_current_hash())
        bot.set_redunda_default_callbacks()
        bot.set_redunda_status(True)

        bot.set_startup_message(self._bot_header + " started on " + bot._location + ".")
        bot.set_standby_message(self._bot_header + " running on " + bot._location + " shifting to standby.")
        bot.set_failover_message(self._bot_header + " running on " + bot._location + " received failover.")

        notifications = Notifications(rooms, bot._storage_prefix + 'notifications.json')
        tags = TagManager(bot._storage_prefix + 'tags.json')
        bot._command_manager.notifications = notifications
        bot._command_manager.tags = tags

        bot.start()
        bot.add_privilege_type(1, "owner")
        bot.set_room_owner_privs_max()

        roomlist = bot._rooms
        halflife = HalflifeListener(roomlist[0], roomlist, notifications, bot._command_manager.tags)
        #deep_smoke = DeepSmokeListener(roomlist[0], roomlist, notifications)

        halflife.start()
        #deep_smoke.start()<commit_msg>Hack for Redunda 500 error<commit_after>import BotpySE as bp
import chatexchange as ce
from HalflifeListener import *
from DeepSmokeListener import *
from CommandUpdate import *
from Notifications import *
from Tagging import *
from commands import *

import os
import subprocess

class Pulse:
    def __init__ (self, nick, email, password, rooms):
        commands = default_commands
        commands.extend([
            CommandUpdate,
            CommandNotifications,
            CommandNotify,
            CommandUnnotify,
            CommandListTags,
            CommandAddTag,
            CommandRemoveTag 
            ])

        self._bot_header = '[ [PulseMonitor](https://github.com/Charcoal-SE/PulseMonitor) ]'

        bot = bp.Bot(nick, commands, rooms, [], "stackexchange.com", email, password)

        try:
            with open(bot._storage_prefix + 'redunda_key.txt', 'r') as file_handle:
                key = file_handle.readlines()[0].rstrip('\n')
            bot.set_redunda_key(key)
        except IOError as ioerr:
            print(str(ioerr))
            print("Bot is not integrated with Redunda.")

        bot.add_file_to_sync({"name": bot._storage_prefix + 'tags.json', "ispickle": False, "at_home": False})
        bot.add_file_to_sync({"name": bot._storage_prefix + 'notifications.json', "ispickle": False, "at_home": False})
        bot.redunda_init(bot_version=self._get_current_hash())
        bot.set_redunda_default_callbacks()
        bot.set_redunda_status(True)

        bot.set_startup_message(self._bot_header + " started on " + bot._location + ".")
        bot.set_standby_message(self._bot_header + " running on " + bot._location + " shifting to standby.")
        bot.set_failover_message(self._bot_header + " running on " + bot._location + " received failover.")

        notifications = Notifications(rooms, bot._storage_prefix + 'notifications.json')
        tags = TagManager(bot._storage_prefix + 'tags.json')
        bot._command_manager.notifications = notifications
        bot._command_manager.tags = tags

        bot.start()
        bot.add_privilege_type(1, "owner")
        bot.set_room_owner_privs_max()

        roomlist = bot._rooms
        halflife = HalflifeListener(roomlist[0], roomlist, notifications, bot._command_manager.tags)
        #deep_smoke = DeepSmokeListener(roomlist[0], roomlist, notifications)

        halflife.start()
        #deep_smoke.start()
{'fraction_non_alphanumeric': 0.10493699648832885, 'fraction_numerical': 0.002272257797975625, 'mean_word_length': 2.870503597122302, 'pattern_counts': {'":': 12, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1595980', 'n_tokens_mistral': 1448, 'n_tokens_neox': 1402, 'n_words': 285}