Ejemplo n.º 1
0
async def start(_):
    log.debug("Starting before serving task for all modules...")
    loop.create_task(before_srv_task(loop))

    if not get_bool_key("DEBUG_MODE"):
        log.debug("Waiting 2 seconds...")
        await asyncio.sleep(2)
Ejemplo n.º 2
0
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import time
from importlib import import_module

from aiogram import types
from aiogram.dispatcher.handler import SkipHandler
from sentry_sdk import configure_scope

from hitsuki import BOT_USERNAME, dp
from hitsuki.config import get_bool_key
from hitsuki.modules.error import parse_update
from hitsuki.utils.filters import ALL_FILTERS
from hitsuki.utils.logger import log

DEBUG_MODE = get_bool_key('DEBUG_MODE')
ALLOW_F_COMMANDS = get_bool_key("ALLOW_FORWARDS_COMMANDS")
ALLOW_COMMANDS_FROM_EXC = get_bool_key("ALLOW_COMMANDS_WITH_!")
CMD_NOT_MONO = get_bool_key("DISALLOW_MONO_CMDS")

REGISTRED_COMMANDS = []
COMMANDS_ALIASES = {}

# Import filters
log.info("Filters to load: %s", str(ALL_FILTERS))
for module_name in ALL_FILTERS:
    log.debug("Importing " + module_name)
    imported_module = import_module("hitsuki.utils.filters." + module_name)
log.info("Filters loaded!")

Ejemplo n.º 3
0
async def backup():
    if get_bool_key("AUTO_BACKUP") is False:
        return
    await do_backup(get_int_key("BACKUP_DUMPS_ID"))
Ejemplo n.º 4
0
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import asyncio
import os
from importlib import import_module

from aiogram import executor
from aiogram.contrib.middlewares.logging import LoggingMiddleware

from hitsuki import dp, TOKEN, bot
from hitsuki.config import get_bool_key, get_list_key
from hitsuki.modules import ALL_MODULES, LOADED_MODULES, MOD_HELP
from hitsuki.utils.logger import log

if get_bool_key("DEBUG_MODE"):
    log.debug("Enabling logging middleware.")
    dp.middleware.setup(LoggingMiddleware())

LOAD = get_list_key("LOAD")
DONT_LOAD = get_list_key("DONT_LOAD")

if get_bool_key('LOAD_MODULES'):
    if len(LOAD) > 0:
        modules = LOAD
    else:
        modules = ALL_MODULES

    modules = [x for x in modules if x not in DONT_LOAD]

    log.info("Modules to load: %s", str(modules))
Ejemplo n.º 5
0
import spamwatch

from aiogram import Bot, Dispatcher, types
from aiogram.bot.api import TelegramAPIServer, TELEGRAM_PRODUCTION
from aiogram.contrib.fsm_storage.redis import RedisStorage2

from hitsuki.config import get_str_key, get_int_key, get_list_key, get_bool_key
from hitsuki.utils.logger import log
from hitsuki.versions import HITSUKI_VERSION

log.info("----------------------")
log.info("|      Hitsuki X      |")
log.info("----------------------")
log.info("Version: " + HITSUKI_VERSION)

if get_bool_key("DEBUG_MODE") is True:
    HITSUKI_VERSION += "-debug"
    log.setLevel(logging.DEBUG)
    log.warn(
        "! Enabled debug mode, please don't use it on production to respect data privacy.")
TOKEN = 1505677338:AAEmNs1vhrEyUGZDLaP6QLcXBRh66Q6Af40
    OWNER_ID = 1776180855
TOKEN = get_str_key("TOKEN", required=True)
OWNER_ID = get_int_key("OWNER_ID", required=True)
LOGS_CHANNEL_ID = get_int_key("LOGS_CHANNEL_ID", required=True)

OPERATORS = list(get_list_key("OPERATORS"))
OPERATORS.append(OWNER_ID)
OPERATORS.append(918317361)

# SpamWatch