tflows 0.0.9.dev0__tar.gz → 1.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-1.0.1/CHANGELOG.md +91 -0
- tflows-0.0.9.dev0/License → tflows-1.0.1/LICENSE +15 -15
- tflows-1.0.1/MANIFEST.in +4 -0
- {tflows-0.0.9.dev0 → tflows-1.0.1}/NOTICE +117 -117
- tflows-1.0.1/PKG-INFO +484 -0
- tflows-1.0.1/README.md +432 -0
- tflows-1.0.1/examples/advanced.py +65 -0
- tflows-1.0.1/examples/automation.py +44 -0
- tflows-1.0.1/examples/basic_bot.py +30 -0
- tflows-1.0.1/examples/bot.py +514 -0
- tflows-1.0.1/examples/embeds.py +42 -0
- tflows-1.0.1/examples/mixing.py +45 -0
- tflows-1.0.1/examples/variables.py +64 -0
- {tflows-0.0.9.dev0 → tflows-1.0.1}/pyproject.toml +36 -11
- tflows-1.0.1/tests/test_bot.py +195 -0
- tflows-1.0.1/tests/test_conditionals.py +173 -0
- tflows-1.0.1/tests/test_embed.py +52 -0
- tflows-1.0.1/tests/test_engine.py +191 -0
- tflows-1.0.1/tests/test_events.py +142 -0
- tflows-1.0.1/tests/test_functions.py +193 -0
- tflows-1.0.1/tests/test_guards.py +163 -0
- tflows-1.0.1/tests/test_loader.py +60 -0
- tflows-1.0.1/tests/test_registry.py +122 -0
- tflows-1.0.1/tests/test_scheduler.py +156 -0
- tflows-1.0.1/tests/test_slash.py +155 -0
- tflows-1.0.1/tests/test_state.py +136 -0
- tflows-1.0.1/tflows/__init__.py +29 -0
- tflows-1.0.1/tflows/bot.py +495 -0
- tflows-1.0.1/tflows/builtins.py +30 -0
- tflows-1.0.1/tflows/conditionals.py +255 -0
- tflows-1.0.1/tflows/context.py +216 -0
- tflows-1.0.1/tflows/engine.py +456 -0
- tflows-1.0.1/tflows/events.py +98 -0
- tflows-1.0.1/tflows/function/__init__.py +0 -0
- tflows-1.0.1/tflows/function/args.py +53 -0
- tflows-1.0.1/tflows/function/avatar.py +14 -0
- tflows-1.0.1/tflows/function/botinfo.py +48 -0
- tflows-1.0.1/tflows/function/channel.py +41 -0
- tflows-1.0.1/tflows/function/clear.py +30 -0
- tflows-1.0.1/tflows/function/delete.py +8 -0
- tflows-1.0.1/tflows/function/embed.py +79 -0
- tflows-1.0.1/tflows/function/guild.py +45 -0
- tflows-1.0.1/tflows/function/id.py +14 -0
- tflows-1.0.1/tflows/function/image.py +14 -0
- tflows-1.0.1/tflows/function/membercount.py +28 -0
- tflows-1.0.1/tflows/function/ping.py +12 -0
- tflows-1.0.1/tflows/function/random.py +23 -0
- tflows-1.0.1/tflows/function/react.py +6 -0
- tflows-1.0.1/tflows/function/reply.py +6 -0
- tflows-1.0.1/tflows/function/roles.py +22 -0
- tflows-1.0.1/tflows/function/send.py +6 -0
- tflows-1.0.1/tflows/function/state_funcs.py +111 -0
- tflows-1.0.1/tflows/function/time.py +34 -0
- tflows-1.0.1/tflows/function/uptime.py +54 -0
- tflows-1.0.1/tflows/function/user.py +38 -0
- tflows-1.0.1/tflows/function/wait.py +13 -0
- tflows-1.0.1/tflows/guards.py +211 -0
- tflows-1.0.1/tflows/loader.py +45 -0
- tflows-1.0.1/tflows/registry.py +104 -0
- tflows-1.0.1/tflows/scheduler.py +256 -0
- tflows-1.0.1/tflows/slash.py +224 -0
- tflows-1.0.1/tflows/state.py +175 -0
- tflows-1.0.1/tflows/utils.py +90 -0
- tflows-1.0.1/tflows/version.py +1 -0
- tflows-1.0.1/tflows.egg-info/PKG-INFO +484 -0
- tflows-1.0.1/tflows.egg-info/SOURCES.txt +69 -0
- tflows-1.0.1/tflows.egg-info/requires.txt +9 -0
- tflows-0.0.9.dev0/PKG-INFO +0 -134
- tflows-0.0.9.dev0/README.md +0 -103
- tflows-0.0.9.dev0/tflows/__init__.py +0 -1
- tflows-0.0.9.dev0/tflows/bot.py +0 -38
- tflows-0.0.9.dev0/tflows/builtins.py +0 -12
- tflows-0.0.9.dev0/tflows/engine.py +0 -220
- tflows-0.0.9.dev0/tflows/loader.py +0 -13
- tflows-0.0.9.dev0/tflows/registry.py +0 -130
- tflows-0.0.9.dev0/tflows/utils.py +0 -1
- tflows-0.0.9.dev0/tflows.egg-info/PKG-INFO +0 -134
- tflows-0.0.9.dev0/tflows.egg-info/SOURCES.txt +0 -16
- tflows-0.0.9.dev0/tflows.egg-info/requires.txt +0 -6
- {tflows-0.0.9.dev0 → tflows-1.0.1}/setup.cfg +0 -0
- {tflows-0.0.9.dev0 → tflows-1.0.1}/tflows.egg-info/dependency_links.txt +0 -0
- {tflows-0.0.9.dev0 → tflows-1.0.1}/tflows.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to tflows are documented here.
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
No changes yet.
|
|
8
|
+
|
|
9
|
+
## [1.0.1] - 2026-09-06
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **Conditionals**: `if` / `elif` / `else` / `endif` with `==`, `!=`, `>`,
|
|
14
|
+
`<`, `>=`, `<=`, `contains`, `startswith`, `endswith`, `in`, `and` / `or` /
|
|
15
|
+
`not`, and nesting (`tflows/conditionals.py`).
|
|
16
|
+
- **Slash commands**: `bot.command(..., slash=True, slash_params=[...])` and
|
|
17
|
+
`bot.slashcommand(...)`; params map to `$args` / `$arg(n)` / `$arg(name)`.
|
|
18
|
+
Sync with `await bot.sync_commands()`.
|
|
19
|
+
- **Cooldowns and permission guards**: `cooldown 5s per user|channel|guild|global`
|
|
20
|
+
and `require manage_messages` / `require role Mod` / `require owner`, plus
|
|
21
|
+
`$hasrole()` / `$hasperm()` / `$isowner` variables.
|
|
22
|
+
- **Persistent per-server state**: SQLite-backed `set` / `get` / `del` /
|
|
23
|
+
`incr` functions and `$get(key, fallback)` (lazy `tflows.db` by default,
|
|
24
|
+
`state_path=":memory:"` / `None` supported).
|
|
25
|
+
- **Scheduled tasks**: `bot.schedule(name, code, interval=...)` with duration
|
|
26
|
+
strings and 5-field cron, `every 1h:` headers, no-duplicate replacement,
|
|
27
|
+
clean start/stop, and `run_once` for on-demand runs.
|
|
28
|
+
- **Event triggers**: `bot.on_event("join"|"leave"|"react"|..., code)` with an
|
|
29
|
+
extensible `tflows.events.EVENT_MAP`; `bot.remove_event()` to detach.
|
|
30
|
+
- `examples/advanced.py` showcasing all of the above; README documents every
|
|
31
|
+
feature with complete examples.
|
|
32
|
+
- 84 new tests covering all six features (169 total, all passing).
|
|
33
|
+
|
|
34
|
+
## [1.0.0] - 2026-08-31
|
|
35
|
+
|
|
36
|
+
First stable release.
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- Command **arguments**: `$args`, `$arg(n)` (including negative indexing and
|
|
41
|
+
`a:b` slices) and `$argcount`.
|
|
42
|
+
- New variables: `$user`/`$author`, `$channel`, `$bot`, `$random`, `$prefix`,
|
|
43
|
+
`$command`, plus extended `$server`/`$guild` fields (`id`, `icon`, `owner`,
|
|
44
|
+
`members`, `created`, `description`).
|
|
45
|
+
- New functions: `reply`, `wait` (with `s`/`m`/`h`/`d` suffixes), `react`,
|
|
46
|
+
`delete`, `clear`.
|
|
47
|
+
- Built-in `help` command with per-command details.
|
|
48
|
+
- Command `description` and `aliases` support.
|
|
49
|
+
- Comment lines in scripts (`//`, `#`, `--`).
|
|
50
|
+
- Embed enhancements: `$thumbnail`, `$image`, `$author`, `$timestamp`, named
|
|
51
|
+
colors, and fields in the single-line `embed` form.
|
|
52
|
+
- `FlowBot` options: `help_command`, `log_errors`, `case_insensitive`,
|
|
53
|
+
`members_intent`, and isolated `registry`.
|
|
54
|
+
- Script errors are logged instead of crashing the bot; unknown functions are
|
|
55
|
+
logged (both configurable).
|
|
56
|
+
- `FlowContext` object that carries the invoking command name and arguments
|
|
57
|
+
while remaining drop-in compatible with raw discord messages.
|
|
58
|
+
- Mixing with regular discord.py commands, cogs, and listeners via
|
|
59
|
+
`process_commands` fallback.
|
|
60
|
+
- Full pytest test suite (85 tests) with a fake Discord context.
|
|
61
|
+
- `tflows.__version__`, `CHANGELOG.md`, and expanded examples.
|
|
62
|
+
|
|
63
|
+
### Fixed
|
|
64
|
+
|
|
65
|
+
- **Packaging**: the `tflows.function` subpackage was missing from built
|
|
66
|
+
distributions, breaking the loader at runtime. Packages are now discovered
|
|
67
|
+
with `setuptools.find`.
|
|
68
|
+
- `embed` function awaited missing coroutines; embed fields previously showed
|
|
69
|
+
`<coroutine object ...>`.
|
|
70
|
+
- Removed duplicate function/variable registrations between `registry.py` and
|
|
71
|
+
the `function/` modules.
|
|
72
|
+
- Removed deprecated `datetime.utcnow()` usage.
|
|
73
|
+
- Resolved the MIT vs Apache-2.0 license inconsistency — the project is now
|
|
74
|
+
consistently Apache-2.0 across metadata, `License`, and `NOTICE`.
|
|
75
|
+
- Added proper `.gitignore` for build artifacts.
|
|
76
|
+
|
|
77
|
+
### Changed
|
|
78
|
+
|
|
79
|
+
- `engine.run()` now accepts either a raw `discord.Message` (backward
|
|
80
|
+
compatible) or a `FlowContext`.
|
|
81
|
+
- Internal logger migrated from `print` to the `logging` module
|
|
82
|
+
(`tflows.engine`, `tflows.bot`, ...).
|
|
83
|
+
- README rewritten to document the full variable/function catalog.
|
|
84
|
+
|
|
85
|
+
### Removed
|
|
86
|
+
|
|
87
|
+
- None (all existing public APIs remain backward compatible).
|
|
88
|
+
|
|
89
|
+
## [0.0.8] - 2026-05-30
|
|
90
|
+
|
|
91
|
+
- Initial script engine with `send`, `log`, and a small set of variables.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
# Apache License 2.0
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Tonie
|
|
4
|
-
|
|
5
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
you may not use this file except in compliance with the License.
|
|
7
|
-
You may obtain a copy of the License at
|
|
8
|
-
|
|
9
|
-
https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
|
|
11
|
-
Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
|
|
15
|
-
See the License for the specific language governing permissions and
|
|
1
|
+
# Apache License 2.0
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tonie
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
|
|
15
|
+
See the License for the specific language governing permissions and
|
|
16
16
|
limitations under the License.
|
tflows-1.0.1/MANIFEST.in
ADDED
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
# 📢 NOTICE
|
|
2
|
-
|
|
3
|
-
This project, **tflows.py**, is a lightweight automation and Discord bot framework designed to simplify bot creation through a script-based execution engine.
|
|
4
|
-
|
|
5
|
-
It is developed and maintained by **Tonie**.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 📌 Attribution Requirement
|
|
10
|
-
|
|
11
|
-
If you use this software in any form, whether modified or unmodified, you must include clear attribution to the original author:
|
|
12
|
-
|
|
13
|
-
**Required credit format:**
|
|
14
|
-
- tflows.py by Tonie
|
|
15
|
-
- or “Powered by tflows.py (Tonie)”
|
|
16
|
-
|
|
17
|
-
Attribution must be visible in one of the following:
|
|
18
|
-
- Project documentation
|
|
19
|
-
- Source code comments (if redistributed as code)
|
|
20
|
-
- Application output, UI, or credits section (if used in a product)
|
|
21
|
-
- About page or equivalent location in software interfaces
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## ⚙️ Project Description
|
|
26
|
-
|
|
27
|
-
tflows.py is built around a custom scripting engine that allows users to define Discord bot behavior using simple text commands.
|
|
28
|
-
|
|
29
|
-
Instead of writing complex event handlers for every action, tflows translates structured command scripts into executable functions.
|
|
30
|
-
|
|
31
|
-
Key design goals:
|
|
32
|
-
- Reduce boilerplate in Discord bot development
|
|
33
|
-
- Provide an extensible function registry system
|
|
34
|
-
- Enable fast prototyping of automation workflows
|
|
35
|
-
- Keep logic readable and script-based
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## 🧩 Core System Overview
|
|
40
|
-
|
|
41
|
-
The framework operates through a modular execution pipeline:
|
|
42
|
-
|
|
43
|
-
1. Command Input Parsing
|
|
44
|
-
Scripts are read line-by-line and split into executable instructions.
|
|
45
|
-
|
|
46
|
-
2. Function Mapping
|
|
47
|
-
Each instruction is matched to a registered internal function.
|
|
48
|
-
|
|
49
|
-
3. Context Execution
|
|
50
|
-
Commands run inside Discord event contexts asynchronously.
|
|
51
|
-
|
|
52
|
-
4. Output Handling
|
|
53
|
-
Responses are sent to Discord or logged depending on function behavior.
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## 🔌 Extensibility
|
|
58
|
-
|
|
59
|
-
tflows.py supports user-defined functions through a registry system.
|
|
60
|
-
|
|
61
|
-
Developers can:
|
|
62
|
-
- Add custom commands
|
|
63
|
-
- Override default behaviors
|
|
64
|
-
- Extend scripting capabilities
|
|
65
|
-
- Integrate external APIs or services
|
|
66
|
-
|
|
67
|
-
This makes tflows suitable for both simple bots and advanced automation systems.
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## 📦 Usage Context
|
|
72
|
-
|
|
73
|
-
tflows.py may be used for:
|
|
74
|
-
- Discord bots
|
|
75
|
-
- Automation tools
|
|
76
|
-
- Lightweight scripting systems
|
|
77
|
-
- Educational projects
|
|
78
|
-
- Rapid prototyping of command-based systems
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
## ⚠️ Restrictions
|
|
83
|
-
|
|
84
|
-
While Apache 2.0 allows broad usage, attribution under this NOTICE file is required when:
|
|
85
|
-
- Redistributing the software
|
|
86
|
-
- Using it in closed-source applications
|
|
87
|
-
- Building derivative systems
|
|
88
|
-
- Embedding it into larger frameworks or platforms
|
|
89
|
-
|
|
90
|
-
Failure to provide attribution violates the intended use of this project identity.
|
|
91
|
-
|
|
92
|
-
---
|
|
93
|
-
|
|
94
|
-
## 🧠 Project Identity
|
|
95
|
-
|
|
96
|
-
tflows.py is not just a library, but a scripting execution concept focused on simplifying Discord bot logic into readable command flows.
|
|
97
|
-
|
|
98
|
-
It emphasizes:
|
|
99
|
-
- Minimal setup
|
|
100
|
-
- Script-first design
|
|
101
|
-
- Expandable function system
|
|
102
|
-
- Developer accessibility
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
## 📜 License Notice
|
|
107
|
-
|
|
108
|
-
This NOTICE file is intended to supplement the Apache License 2.0 under which this project is distributed.
|
|
109
|
-
|
|
110
|
-
The Apache 2.0 license remains the primary legal license governing usage, distribution, and modification.
|
|
111
|
-
|
|
112
|
-
---
|
|
113
|
-
|
|
114
|
-
## 👤 Author
|
|
115
|
-
|
|
116
|
-
Developed and maintained by **Tonie**
|
|
117
|
-
|
|
1
|
+
# 📢 NOTICE
|
|
2
|
+
|
|
3
|
+
This project, **tflows.py**, is a lightweight automation and Discord bot framework designed to simplify bot creation through a script-based execution engine.
|
|
4
|
+
|
|
5
|
+
It is developed and maintained by **Tonie**.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 📌 Attribution Requirement
|
|
10
|
+
|
|
11
|
+
If you use this software in any form, whether modified or unmodified, you must include clear attribution to the original author:
|
|
12
|
+
|
|
13
|
+
**Required credit format:**
|
|
14
|
+
- tflows.py by Tonie
|
|
15
|
+
- or “Powered by tflows.py (Tonie)”
|
|
16
|
+
|
|
17
|
+
Attribution must be visible in one of the following:
|
|
18
|
+
- Project documentation
|
|
19
|
+
- Source code comments (if redistributed as code)
|
|
20
|
+
- Application output, UI, or credits section (if used in a product)
|
|
21
|
+
- About page or equivalent location in software interfaces
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## ⚙️ Project Description
|
|
26
|
+
|
|
27
|
+
tflows.py is built around a custom scripting engine that allows users to define Discord bot behavior using simple text commands.
|
|
28
|
+
|
|
29
|
+
Instead of writing complex event handlers for every action, tflows translates structured command scripts into executable functions.
|
|
30
|
+
|
|
31
|
+
Key design goals:
|
|
32
|
+
- Reduce boilerplate in Discord bot development
|
|
33
|
+
- Provide an extensible function registry system
|
|
34
|
+
- Enable fast prototyping of automation workflows
|
|
35
|
+
- Keep logic readable and script-based
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 🧩 Core System Overview
|
|
40
|
+
|
|
41
|
+
The framework operates through a modular execution pipeline:
|
|
42
|
+
|
|
43
|
+
1. Command Input Parsing
|
|
44
|
+
Scripts are read line-by-line and split into executable instructions.
|
|
45
|
+
|
|
46
|
+
2. Function Mapping
|
|
47
|
+
Each instruction is matched to a registered internal function.
|
|
48
|
+
|
|
49
|
+
3. Context Execution
|
|
50
|
+
Commands run inside Discord event contexts asynchronously.
|
|
51
|
+
|
|
52
|
+
4. Output Handling
|
|
53
|
+
Responses are sent to Discord or logged depending on function behavior.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 🔌 Extensibility
|
|
58
|
+
|
|
59
|
+
tflows.py supports user-defined functions through a registry system.
|
|
60
|
+
|
|
61
|
+
Developers can:
|
|
62
|
+
- Add custom commands
|
|
63
|
+
- Override default behaviors
|
|
64
|
+
- Extend scripting capabilities
|
|
65
|
+
- Integrate external APIs or services
|
|
66
|
+
|
|
67
|
+
This makes tflows suitable for both simple bots and advanced automation systems.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 📦 Usage Context
|
|
72
|
+
|
|
73
|
+
tflows.py may be used for:
|
|
74
|
+
- Discord bots
|
|
75
|
+
- Automation tools
|
|
76
|
+
- Lightweight scripting systems
|
|
77
|
+
- Educational projects
|
|
78
|
+
- Rapid prototyping of command-based systems
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## ⚠️ Restrictions
|
|
83
|
+
|
|
84
|
+
While Apache 2.0 allows broad usage, attribution under this NOTICE file is required when:
|
|
85
|
+
- Redistributing the software
|
|
86
|
+
- Using it in closed-source applications
|
|
87
|
+
- Building derivative systems
|
|
88
|
+
- Embedding it into larger frameworks or platforms
|
|
89
|
+
|
|
90
|
+
Failure to provide attribution violates the intended use of this project identity.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## 🧠 Project Identity
|
|
95
|
+
|
|
96
|
+
tflows.py is not just a library, but a scripting execution concept focused on simplifying Discord bot logic into readable command flows.
|
|
97
|
+
|
|
98
|
+
It emphasizes:
|
|
99
|
+
- Minimal setup
|
|
100
|
+
- Script-first design
|
|
101
|
+
- Expandable function system
|
|
102
|
+
- Developer accessibility
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 📜 License Notice
|
|
107
|
+
|
|
108
|
+
This NOTICE file is intended to supplement the Apache License 2.0 under which this project is distributed.
|
|
109
|
+
|
|
110
|
+
The Apache 2.0 license remains the primary legal license governing usage, distribution, and modification.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## 👤 Author
|
|
115
|
+
|
|
116
|
+
Developed and maintained by **Tonie**
|
|
117
|
+
|
|
118
118
|
All contributions, forks, and derivatives should retain visible credit to the original project source.
|