tflows 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
tflows-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,31 @@
1
+ Metadata-Version: 2.4
2
+ Name: tflows
3
+ Version: 0.0.1
4
+ Summary: Simple automation and bot framework inspired by aoi.js style syntax
5
+ Author: Tonie
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: discord.py
9
+
10
+ # tflow
11
+
12
+ tflow is a lightweight automation and Discord bot framework inspired by aoi.js style syntax.
13
+
14
+ ## Features
15
+ - Simple command system
16
+ - Automation engine (WIP)
17
+ - Discord bot abstraction
18
+
19
+ ## Example
20
+
21
+ ```python
22
+ from tflow import FlowBot
23
+
24
+ bot = FlowBot(prefix="!")
25
+
26
+ bot.command(
27
+ name="ping",
28
+ code="pong"
29
+ )
30
+
31
+ bot.run("TOKEN")
tflows-0.0.1/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # tflow
2
+
3
+ tflow is a lightweight automation and Discord bot framework inspired by aoi.js style syntax.
4
+
5
+ ## Features
6
+ - Simple command system
7
+ - Automation engine (WIP)
8
+ - Discord bot abstraction
9
+
10
+ ## Example
11
+
12
+ ```python
13
+ from tflow import FlowBot
14
+
15
+ bot = FlowBot(prefix="!")
16
+
17
+ bot.command(
18
+ name="ping",
19
+ code="pong"
20
+ )
21
+
22
+ bot.run("TOKEN")
@@ -0,0 +1,17 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tflows"
7
+ version = "0.0.1"
8
+ description = "Simple automation and bot framework inspired by aoi.js style syntax"
9
+ authors = [{ name="Tonie" }]
10
+ readme = "README.md"
11
+ requires-python = ">=3.10"
12
+ dependencies = [
13
+ "discord.py"
14
+ ]
15
+
16
+ [tool.setuptools]
17
+ packages = ["tflows"]
tflows-0.0.1/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ from .tflow.bot import FlowBot
@@ -0,0 +1,34 @@
1
+ import discord
2
+ from discord.ext import commands
3
+ from .engine import Engine
4
+ from .functions import registry
5
+ import tflow.builtins
6
+
7
+ class FlowBot(commands.Bot):
8
+ def __init__(self, prefix="!"):
9
+ intents = discord.Intents.default()
10
+ intents.message_content = True
11
+
12
+ super().__init__(command_prefix=prefix, intents=intents)
13
+
14
+ self.commands_map = {}
15
+ self.engine = Engine(registry)
16
+
17
+ def command(self, name, code):
18
+ self.commands_map[name] = code
19
+
20
+ async def on_message(self, message):
21
+ if message.author.bot:
22
+ return
23
+
24
+ await self.process_commands(message)
25
+
26
+ prefix = self.command_prefix
27
+ if not message.content.startswith(prefix):
28
+ return
29
+
30
+ cmd_name = message.content[len(prefix):].split()[0]
31
+
32
+ if cmd_name in self.commands_map:
33
+ code = self.commands_map[cmd_name]
34
+ await self.engine.run(message, code)
@@ -0,0 +1,11 @@
1
+ from .functions import registry
2
+
3
+
4
+ @registry.register("send")
5
+ async def send(ctx, args):
6
+ await ctx.channel.send(args)
7
+
8
+
9
+ @registry.register("log")
10
+ async def log(ctx, args):
11
+ print(f"[tflow log] {args}")
@@ -0,0 +1,22 @@
1
+ class Engine:
2
+ def __init__(self, registry):
3
+ self.registry = registry
4
+
5
+ async def run(self, ctx, code: str):
6
+ lines = code.strip().split("\n")
7
+
8
+ for line in lines:
9
+ line = line.strip()
10
+ if not line:
11
+ continue
12
+
13
+ parts = line.split(" ", 1)
14
+ command = parts[0]
15
+ args = parts[1] if len(parts) > 1 else ""
16
+
17
+ func = self.registry.get(command)
18
+
19
+ if func:
20
+ await func(ctx, args)
21
+ else:
22
+ print(f"[tflow] Unknown function: {command}")
@@ -0,0 +1,15 @@
1
+ class FunctionRegistry:
2
+ def __init__(self):
3
+ self.functions = {}
4
+
5
+ def register(self, name):
6
+ def wrapper(func):
7
+ self.functions[name] = func
8
+ return func
9
+ return wrapper
10
+
11
+ def get(self, name):
12
+ return self.functions.get(name)
13
+
14
+
15
+ registry = FunctionRegistry()
File without changes
@@ -0,0 +1,31 @@
1
+ Metadata-Version: 2.4
2
+ Name: tflows
3
+ Version: 0.0.1
4
+ Summary: Simple automation and bot framework inspired by aoi.js style syntax
5
+ Author: Tonie
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: discord.py
9
+
10
+ # tflow
11
+
12
+ tflow is a lightweight automation and Discord bot framework inspired by aoi.js style syntax.
13
+
14
+ ## Features
15
+ - Simple command system
16
+ - Automation engine (WIP)
17
+ - Discord bot abstraction
18
+
19
+ ## Example
20
+
21
+ ```python
22
+ from tflow import FlowBot
23
+
24
+ bot = FlowBot(prefix="!")
25
+
26
+ bot.command(
27
+ name="ping",
28
+ code="pong"
29
+ )
30
+
31
+ bot.run("TOKEN")
@@ -0,0 +1,13 @@
1
+ README.md
2
+ pyproject.toml
3
+ tflows/__init__.py
4
+ tflows/bot.py
5
+ tflows/builtins.py
6
+ tflows/engine.py
7
+ tflows/functions.py
8
+ tflows/utils.py
9
+ tflows.egg-info/PKG-INFO
10
+ tflows.egg-info/SOURCES.txt
11
+ tflows.egg-info/dependency_links.txt
12
+ tflows.egg-info/requires.txt
13
+ tflows.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ discord.py
@@ -0,0 +1 @@
1
+ tflows