def __init__(self, bot: Red): self.bot = bot self.config = Config.get_conf(self, identifier=9765573181940385953309, force_registration=True) default_guild = { "channel": None, "role": None, "message": "It's been 2 hours since the last successful bump, could someone run `!d bump`?", "tyMessage": "{member(mention)} thank you for bumping! Make sure to leave a review at <https://disboard.org/server/{guild(id)}>.", "nextBump": None, "lock": False, "clean": False, } self.config.register_guild(**default_guild) self.channel_cache = {} self.bump_loop = self.create_task(self.bump_check_loop()) self.bump_tasks = defaultdict(dict) # self.cache = defaultdict(lambda _: self.default_guild_cache.copy()) bot.add_dev_env_value("bprm", lambda _: self) blocks = [ tse.LooseVariableGetterBlock(), tse.AssignmentBlock(), tse.IfBlock(), tse.EmbedBlock(), ] self.tagscript_engine = tse.Interpreter(blocks)
def __init__(self, bot: Red) -> None: self.bot = bot self.config = Config.get_conf( self, identifier=567234895692346562369, force_registration=True, ) default_guild = {"tags": {}} default_global = { "tags": {}, "blocks": {}, "async_enabled": False, "dot_parameter": False } self.config.register_guild(**default_guild) self.config.register_global(**default_global) self.guild_tag_cache = defaultdict(dict) self.global_tag_cache = {} self.initialize_task = None self.dot_parameter: bool = None self.async_enabled: bool = None self.initialize_task = self.create_task(self.initialize()) self.session = aiohttp.ClientSession() self.docs: list = [] if bot._cli_flags.logging_level == logging.DEBUG: logging.getLogger("TagScriptEngine").setLevel(logging.DEBUG) bot.add_dev_env_value("tags", lambda ctx: self) super().__init__()
def __init__(self, bot: Red) -> None: self.bot = bot self.application_id = None self.eval_command = None self.http = SlashHTTP(self) self.config = Config.get_conf( self, identifier=70342502093747959723475890, force_registration=True, ) default_guild = {"tags": {}} default_global = {"application_id": None, "eval_command": None} self.config.register_guild(**default_guild) self.config.register_global(**default_global) self.command_cache = {} self.button_cache = {} self.guild_tag_cache: Dict[int, Dict[int, SlashTag]] = defaultdict(dict) self.global_tag_cache = {} self.load_task = self.create_task(self.initialize_task()) bot.add_dev_env_value("st", lambda ctx: self) super().__init__()
def __init__(self, bot: Red): self.bot = bot self.config = Config.get_conf(self, identifier=9765573181940385953309, force_registration=True) self.config.register_guild(**self.default_guild) self.channel_cache = {} self.bump_tasks: DefaultDict[int, Dict[str, asyncio.Task]] = defaultdict(dict) # self.cache = defaultdict(lambda _: self.default_guild_cache.copy()) try: bot.add_dev_env_value("bprm", lambda _: self) except RuntimeError: pass blocks = [ tse.LooseVariableGetterBlock(), tse.AssignmentBlock(), tse.IfBlock(), tse.EmbedBlock(), ] self.tagscript_engine = tse.Interpreter(blocks) self.bump_loop = self.create_task(self.bump_check_loop()) self.initialize_task = self.create_task(self.initialize())
def __init__(self, bot: Red) -> None: self.bot = bot self.config = Config.get_conf( self, identifier=567234895692346562369, force_registration=True, ) default_guild = {"tags": {}} default_global = {"tags": {}} self.config.register_guild(**default_guild) self.config.register_global(**default_global) tse_blocks = [ tse.MathBlock(), tse.RandomBlock(), tse.RangeBlock(), tse.AnyBlock(), tse.IfBlock(), tse.AllBlock(), tse.BreakBlock(), tse.StrfBlock(), tse.StopBlock(), tse.AssignmentBlock(), tse.FiftyFiftyBlock(), tse.ShortCutRedirectBlock("args"), tse.LooseVariableGetterBlock(), tse.SubstringBlock(), tse.EmbedBlock(), tse.ReplaceBlock(), tse.PythonBlock(), tse.URLEncodeBlock(), tse.RequireBlock(), tse.BlacklistBlock(), tse.CommandBlock(), tse.OverrideBlock(), ] tag_blocks = [ DeleteBlock(), SilentBlock(), ReactBlock(), RedirectBlock(), ReactUBlock(), ] self.engine = tse.Interpreter(tse_blocks + tag_blocks) self.role_converter = commands.RoleConverter() self.channel_converter = commands.TextChannelConverter() self.member_converter = commands.MemberConverter() self.emoji_converter = commands.EmojiConverter() self.guild_tag_cache = defaultdict(dict) self.global_tag_cache = {} self.cache_task = asyncio.create_task(self.cache_tags()) self.session = aiohttp.ClientSession() self.docs: list = [] super().__init__() bot.add_dev_env_value("tags", lambda ctx: self)
def __init__(self, bot: Red) -> None: self.bot = bot self.application_id = None self.eval_command = None self.http = SlashHTTP(self) self.config = Config.get_conf( self, identifier=70342502093747959723475890, force_registration=True, ) default_guild = {"tags": {}} default_global = {"application_id": None, "eval_command": None} self.config.register_guild(**default_guild) self.config.register_global(**default_global) tse_blocks = [ tse.MathBlock(), tse.RandomBlock(), tse.RangeBlock(), tse.AnyBlock(), tse.IfBlock(), tse.AllBlock(), tse.BreakBlock(), tse.StrfBlock(), tse.StopBlock(), tse.AssignmentBlock(), tse.FiftyFiftyBlock(), tse.LooseVariableGetterBlock(), tse.SubstringBlock(), tse.EmbedBlock(), tse.ReplaceBlock(), tse.PythonBlock(), tse.RequireBlock(), tse.BlacklistBlock(), tse.URLEncodeBlock(), tse.CommandBlock(), ] slash_blocks = [HideBlock()] self.engine = tse.Interpreter(tse_blocks + slash_blocks) self.role_converter = commands.RoleConverter() self.channel_converter = commands.TextChannelConverter() self.member_converter = commands.MemberConverter() self.emoji_converter = commands.EmojiConverter() self.command_cache = {} self.guild_tag_cache: Dict[int, Dict[int, SlashTag]] = defaultdict(dict) self.global_tag_cache = {} self.load_task = self.create_task(self.initialize_task()) bot.add_dev_env_value("st", lambda ctx: self)
def __init__(self, bot: Red) -> None: self.bot = bot self.config: Config = Config.get_conf(self, 418078199982063626, force_registration=True) self.config.register_guild( poll_settings={}, poll_user_choices={}, ) self.loop = bot.loop.create_task(self.buttonpoll_loop()) self.loop_meta = VexLoop("ButtonPoll", 60.0) self.polls: List[Poll] = [] bot.add_dev_env_value("bpoll", lambda _: self) self.plot_executor = ThreadPoolExecutor( max_workers=16, thread_name_prefix="buttonpoll_plot")
def __init__(self, bot: Red) -> None: self.bot = bot self.config = Config.get_conf( self, identifier=567234895692346562369, force_registration=True, ) default_guild = {"tags": {}} default_global = {"tags": {}} self.config.register_guild(**default_guild) self.config.register_global(**default_global) self.guild_tag_cache = defaultdict(dict) self.global_tag_cache = {} self.cache_task = asyncio.create_task(self.cache_tags()) self.session = aiohttp.ClientSession() self.docs: list = [] bot.add_dev_env_value("tags", lambda ctx: self) super().__init__()
def __init__(self, bot: Red) -> None: self.bot = bot self.do_write: int = 2 # do write on first 2 loops, then append after self.cmd_count = 0 self.msg_count = 0 self.config = Config.get_conf(self, identifier=418078199982063626, force_registration=True) self.config.register_global(version=1, maxpoints=25_000) self.config.register_global(main_df={}) # deprecated self.last_loop_time = "Loop not ran yet" self.last_loop_raw: Optional[float] = None self.driver = PandasSQLiteDriver(bot, type(self).__name__, "timeseries.db") bot.add_dev_env_value("stattrack", lambda _: self)