def __init__(self, bot: Red) -> None: self.bot = bot self.config = Config.get_conf( self, identifier=567234895692346562369, force_registration=True, ) default_guild = {"tags": {}} self.config.register_guild(**default_guild) blocks = stable_blocks + [ block.MathBlock(), block.RandomBlock(), block.RangeBlock(), block.AnyBlock(), block.IfBlock(), block.AllBlock(), block.BreakBlock(), block.StrfBlock(), block.StopBlock(), block.AssignmentBlock(), block.FiftyFiftyBlock(), block.ShortCutRedirectBlock("args"), block.LooseVariableGetterBlock(), block.SubstringBlock(), ] self.engine = Interpreter(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.task = asyncio.create_task(self.cache_tags())
def __init__(self, bot: Red) -> None: self.bot = bot self.config = Config.get_conf( self, identifier=567234895692346562369, force_registration=True, ) default_guild = {"tags": {}} self.config.register_guild(**default_guild) blocks = [ block.MathBlock(), block.RandomBlock(), block.RangeBlock(), block.AnyBlock(), block.IfBlock(), block.AllBlock(), block.BreakBlock(), block.StrfBlock(), block.StopBlock(), block.AssignmentBlock(), block.FiftyFiftyBlock(), block.ShortCutRedirectBlock("message"), block.LooseVariableGetterBlock(), block.SubstringBlock(), ] self.engine = Interpreter(blocks)
def __init__(self, bot: Red) -> None: self.bot = bot cog = self.bot.get_cog("CustomCommands") if cog: raise RuntimeError( "This cog conflicts with CustomCommands and cannot be loaded with both at the same time." ) self.config = Config.get_conf( self, identifier=567234895692346562369, force_registration=True, ) default_guild = {"tags": {}} self.config.register_guild(**default_guild) blocks = stable_blocks + [ block.MathBlock(), block.RandomBlock(), block.RangeBlock(), block.AnyBlock(), block.IfBlock(), block.AllBlock(), block.BreakBlock(), block.StrfBlock(), block.StopBlock(), block.AssignmentBlock(), block.FiftyFiftyBlock(), block.ShortCutRedirectBlock("message"), block.LooseVariableGetterBlock(), block.SubstringBlock(), ] self.engine = Interpreter(blocks)
blocks = [ block.MathBlock(), block.RandomBlock(), block.RangeBlock(), block.AnyBlock(), block.IfBlock(), block.AllBlock(), block.BreakBlock(), block.StrfBlock(), block.StopBlock(), block.AssignmentBlock(), block.FiftyFiftyBlock(), block.ShortCutRedirectBlock("message"), block.LooseVariableGetterBlock(), block.SubstringBlock(), ] x = Interpreter(blocks) def press(button): o = x.process(app.getTextArea("input")).body app.clearTextArea("output") app.setTextArea("output", o) app = gui("TSE Playground", "750x450") app.setPadding([2, 2]) app.setInPadding([2, 2]) app.addTextArea("input", text="I see {rand:1,2,3,4} new items!", row=0, column=0) app.addTextArea("output", text="Press process to continue", row=0, column=1)