Example #1
0
def alert():
    if request.method == 'GET':
        return '404'
    elif request.method == 'POST':
        bot = Bot()
        bot.data()
        return '200'
    return '200'
Example #2
0
    def load_config(self):
        self.config = Config(self.logger)

        # Language
        language = self.config['lang']
        self.language.set_language(language)
        self.logger.info(self.t('server.load_config.set_lang', language))

        # api_url and receive_url
        self.logger.info(
            self.t('server.load_config.set_api_url', self.config['api_url']))
        self.logger.info(
            self.t('server.load_config.set_receive_url',
                   self.config['receive_url']))

        # Bot
        self.bot = Bot(self)

        # Debug mode
        if self.config['debug_mode'] is True:
            self.logger.set_level(debug=True)
            self.logger.info(self.t('server.load_config.debug_on'))
        else:
            self.logger.set_level(debug=False)
            self.logger.info(self.t('server.load_config.debug_off'))
Example #3
0
    def __init__(self, bot_id, cfg, task_factory, encoder, Actor, Critic, goal_encoder):
        self.cfg = cfg
        self.bot = Bot(
                cfg,
                bot_id,
                encoder,
                goal_encoder,
                Actor,
                Critic,
                task_factory.state_size,
                task_factory.action_size,
                task_factory.wrap_action,
                task_factory.wrap_value)
        self.bot.share_memory() # !! must be done from main process !!

        self.iter = 0
        self.freezed = 0

        self.counter = 1
        self.tau = LinearSchedule(cfg['tau_replay_counter'], cfg['tau_base'], cfg['tau_final'])

        self.lock = Lock()
        self.bot = BotProxy(self.lock, cfg, self.bot, cfg['device'])
Example #4
0
def setup(bot: Bot):
    bot.add_cog(ErrorHandler(bot))
Example #5
0
def setup(bot: Bot):
    bot.add_cog(Config(bot))
Example #6
0
"""
Launches the bot.
Copyright (C) 2021  ItsArtemiz (Augadh Verma)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
"""

from __future__ import annotations

from utils.bot import Bot

if __name__ == '__main__':
    bot = Bot()
    bot.run()
Example #7
0
import discord
from discord.ext import commands
from utils.bot import Bot
import json
from discord_slash import SlashCommand
import motor.motor_asyncio

bot = Bot()
slash = SlashCommand(bot, override_type=True, sync_commands=True)

bot.load_cogs()

bot.run(bot.config['token'])
Example #8
0
    "TWITTER_CONSUMER_SECRET",
    "TWITTER_ACCESS_TOKEN",
    "TWITTER_ACCESS_TOKEN_SECRET",
]

# Remove previous env variables from environment
# and check if any missing env variable
for var in env_vars:
    if var in os.environ:
        del os.environ[var]
    else:
        try:
            os.getenv(var)
        except Exception as error:
            log.error(
                "Error: Missing environmental variable {} in .env file".format(
                    var))
            sys.exit()

if "-t" in sys.argv:
    print(colorama.Fore.MAGENTA + "Executing in TEST mode")
    load_dotenv("env/tests.env")
else:
    print(colorama.Fore.MAGENTA + "Executing in NORMAL mode")

    load_dotenv("env/furbot.env")

token = os.getenv("DISCORD_TOKEN")
bot = Bot(token)
bot.run()
Example #9
0
def setup(bot: Bot):
    bot.add_cog(MyHelp(bot))
Example #10
0
def setup(bot: Bot):
    bot.add_cog(EventLogger(bot))
Example #11
0
import os

from utils.bot import Bot

adb_path = os.path.join("platform-tools", "adb.exe")
temp_path = "tmp"

bot = Bot(adb_path=adb_path, temp_path=temp_path, sleep_sec=2)

if __name__ == "__main__":
    for i in range(6):
        bot.take_exam(weekly=False)
        if i == 5:
            bot.take_exam(weekly=True)
Example #12
0
def setup(bot: Bot):
    bot.add_cog(ReactionRoles(bot))
Example #13
0
def setup(bot: Bot):
    bot.add_cog(Artists(bot))
Example #14
0
def setup(bot: Bot):
    bot.add_cog(Info(bot))
Example #15
0
logging.basicConfig(format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
                    level=logging.INFO)

log = logging.getLogger("bot")
log.setLevel(logging.INFO)

description = """
Hi! I'm a bot that will highlight code for you.

Just use /code with some code, and I'll try to detect a language and highlight it.
You can optionally specify a language before the code.
"""

log.info("Starting bot...")
bot = Bot(token=config.token, description=description, owner_ids=[1389169565])

bot.code_cache = deque(maxlen=500)
# chat_id: Code
bot.ongoing_changes = {}

LANGUAGE = 0

# Creating a predefined button list
buttons = [
    telegram.InlineKeyboardButton("Change Language",
                                  callback_data="change_lang")
]
change_lang_markup = telegram.InlineKeyboardMarkup(
    build_menu(buttons, n_cols=1))
Example #16
0
def setup(bot: Bot):
    bot.add_cog(Administration(bot))
Example #17
0
def setup(bot: Bot):
    bot.add_cog(Tech(bot))