Skip to content

Commit

Permalink
Version 1.2!
Browse files Browse the repository at this point in the history
Official release of v1.2 - New features, bug fixes, and stability improvements included!

- Newly added
	- Now for **Slack** and **Discord**, you no longer need to create a bot, now the framework handles completely that part with integrated bots.
	- Guided User Interface (GUI) for management purposes. Now you can control, see the logs and exercise status in real time in a newly designed Web interface.
	- New framework's modular structure.
	- New simplified user's input, now you can run a TTX with just a few lines of code, less than 10!
	- New class to log all the output from the bots and framework, such as status, errors, warnings and more.

- Updated
	- Updated the code to work with all updates to the specified platform libraries.
	- Requirements are now fulfilled when installing the framework with the specified module, as `pip3 install "T3SF[Platform]"`.

- Deprecated
	- This versions is not ready for platforms as **Telegram** and **WhatsApp**, we are constantly working to update the framework for all the platforms. If you want to use the framework with those platform, use the previous `Version 1.1`.
  • Loading branch information
lanfranB4 committed Apr 5, 2023
1 parent 5f70f8b commit b08c49c
Show file tree
Hide file tree
Showing 44 changed files with 1,383 additions and 1,113 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
# Change Log
All notable changes to this project will be documented in this file.

## [1.2] - 2023-04-05

Official release of v1.2 - New features, bug fixes, and stability improvements included!

### Newly added
- Now for **Slack** and **Discord**, you no longer need to create a bot, now the framework handles completely that part with integrated bots.
- Guided User Interface (GUI) for management purposes. Now you can control, see the logs and exercise status in real time in a newly designed Web interface.
- New framework's modular structure.
- New simplified user's input, now you can run a TTX with just a few lines of code, less than 10!
- New class to log all the output from the bots and framework, such as status, errors, warnings and more.

### Updated
- Updated the code to work with all updates to the specified platform libraries.
- Requirements are now fullfilled when installing the framework with the specified module, as `pip3 install "T3SF[Platform]"`.

### Deprecated
- This versions is not ready for platforms as **Telegram** and **WhatsApp**, we are constantly working to update the framework for all the platforms. If you want to use the framework with those platform, use the previous `Version 1.1`.

## [1.1] - 2022-10-28

Version 1.1 has been officially released, with new features, bug fixes and stability issues resolved!
Expand Down
78 changes: 0 additions & 78 deletions Discord/bot.py

This file was deleted.

12 changes: 0 additions & 12 deletions Discord/requirements.txt

This file was deleted.

98 changes: 26 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
T3SF is a framework that offers a modular structure for the orchestration of events based on a master scenario events list (MSEL) together with a set of rules defined for each exercise (optional) and a configuration that allows defining the parameters of the corresponding platform. The main module performs the communication with the specific module (Discord, Slack, Telegram, etc.) that allows the events to present the events in the input channels as injects for each platform. In addition, the framework supports different use cases: "single organization, multiple areas", "multiple organization, single area" and "multiple organization, multiple areas".

## Getting Things Ready <a name = "Starting"></a>
Platform-independent, you will need to install the framework itself!
To use the framework with your desired platform, whether it's Slack or Discord, you will need to install the required modules for that platform. But don't worry, installing these modules is easy and straightforward.

To do this, you can follow this simple step-by-step guide, or if you're already comfortable installing packages with `pip`, you can skip to the last step!

Expand All @@ -40,9 +40,21 @@ python -m venv .venv # We will create a python virtual enviroment
source .venv/bin/activate # Let's get inside it

pip install -U pip # Upgrade pip
pip install T3SF # Install the framework!
```

Once you have created a Python virtual environment and activated it, you can install the T3SF framework for your desired platform by running the following command:

```bash
pip install "T3SF[Discord]" # Install the framework to work with Discord
```
or

```bash
pip install "T3SF[Slack]" # Install the framework to work with Slack
```

This will install the T3SF framework along with the required dependencies for your chosen platform. Once the installation is complete, you can start using the framework with your platform of choice.

We strongly recommend following the platform-specific guidance within our Read The Docs! Here are the links:

- [Discord](https://t3sf.readthedocs.io/en/latest/Discord.html#installation)
Expand All @@ -53,85 +65,27 @@ We strongly recommend following the platform-specific guidance within our Read T
## Usage <a name="Usage"></a>
We created this framework to simplify all your work!

You will need to edit the `config.ini` file with your desired platform and the file to fetch your incidents.

Here is an example if you want to run the framework with the `Discord` bot.
Once you have everything ready, use our template for the `main.py`, or modify the following code:

```ini
[General]
Platform : Discord

TTX_File : MSEL_BASE4.json
```

Here is a code snippet used as an example of the [Discord bot](./Discord/bot.py):
Here is an example if you want to run the framework with the `Discord` bot and a `GUI`.

```python
from discord.ext import commands
from dotenv import load_dotenv
import discord
import os

from T3SF import T3SF

load_dotenv()

TOKEN = os.getenv('DISCORD_TOKEN')

intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='!', intents=intents)

T3SF = T3SF(bot=bot) # We need to pass the bot's object to the framework.

@bot.event
async def on_interaction(interaction):
await T3SF.PollAnswerHandler(payload=interaction)

@bot.command(name="start", help='Starts the Incidents Game. Usage -> !start')
async def start(ctx):
# When the bot receives the command !start,
# we are going to start the game!
await T3SF.ProcessIncidents(function_type = "start", ctx=ctx)

bot.run(TOKEN)

```

Here is another code snippet for the [Slack bot](./Slack/bot.py)

```python
from slack_bolt.adapter.socket_mode.async_handler import AsyncSocketModeHandler
from slack_bolt.app.async_app import AsyncApp
from dotenv import load_dotenv
import asyncio
import os

from T3SF import *

load_dotenv()

app = AsyncApp(token=os.environ["SLACK_BOT_TOKEN"])

T3SF = T3SF(app=app) # We need to pass the app's object to the framework.
async def main():
await T3SF.start(MSEL="MSEL_TTX.json", platform="Discord", gui=True)

@app.action(re.compile("option"))
async def poll_handler(ack, body, payload):
await T3SF.PollAnswerHandler(ack=ack,body=body,payload=payload)
if __name__ == '__main__':
asyncio.run(main())
```

@app.message("!start")
async def start(message, say):
# When the bot receives the command !start,
# we are going to start the game!
await T3SF.ProcessIncidents(function_type = "start", ctx=message)
Or if you prefer to run the framework without `GUI` and with `Slack` instead, you can modify the arguments, and that's it!

# Let's start the bot!
async def main():
handler = AsyncSocketModeHandler(app, os.environ["SLACK_APP_TOKEN"])
await handler.start_async()
Yes, that simple!

if __name__ == "__main__":
asyncio.run(main())
```python
await T3SF.start(MSEL="MSEL_TTX.json", platform="Slack", gui=False)
```

If you need more help, you can always check our documentation [here](https://t3sf.readthedocs.io/en/latest/)!
If you need more help, you can always check our documentation [here](https://t3sf.readthedocs.io/en/latest/)!
91 changes: 0 additions & 91 deletions Slack/bot.py

This file was deleted.

13 changes: 0 additions & 13 deletions Slack/requirements.txt

This file was deleted.

Loading

0 comments on commit b08c49c

Please sign in to comment.