コード例 #1
0
    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())
コード例 #2
0
ファイル: tags.py プロジェクト: SergeTFM/phen-cogs
 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)
コード例 #3
0
ファイル: tags.py プロジェクト: design4webdev/phen-cogs
 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)
コード例 #4
0
from TagScriptEngine import block, Interpreter, adapter
from appJar import gui

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])