diff --git a/README.md b/README.md index 7331478..e00ff57 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Open `.env` and insert the following fields: |----------------|-----------------------------------------------------------------------------------------------------------| | `ACCESS_TOKEN` | Access token you can take [here](https://twitchtokengenerator.com/) (be sure you selected Bot Chat Token) | | `PREFIX` | Prefix you want to use for your bot | -| `CHANNEL` | The name of the your Twitch channel you want the bot to run at | +| `CHANNEL` | The name of the your Twitch channel you want the bot to run at (separate by comma) | | `DISCORD` | Link to your discord server | Start Bot: diff --git a/src/main.py b/src/main.py index 2b378fe..f3de140 100644 --- a/src/main.py +++ b/src/main.py @@ -5,7 +5,7 @@ from utils.utils import load class Bot(commands.Bot): def __init__(self): self.keys = load(["ACCESS_TOKEN", "PREFIX", "CHANNEL"]) - super().__init__(token=self.keys["ACCESS_TOKEN"], prefix=self.keys["PREFIX"], initial_channels=[f'{self.keys["CHANNEL"]}']) + super().__init__(token=self.keys["ACCESS_TOKEN"], prefix=self.keys["PREFIX"], initial_channels=self.keys["CHANNEL"]) async def event_ready(self): print(f"Logged in as {self.nick}") diff --git a/src/utils/utils.py b/src/utils/utils.py index 6719e78..744d306 100644 --- a/src/utils/utils.py +++ b/src/utils/utils.py @@ -8,7 +8,10 @@ def load(variables): load_dotenv() for var in variables: try: - keys[var] = environ[var] + res = environ[var] + if var == "CHANNEL": # create a list + res = res.split(',') + keys[var] = res except KeyError: print(f"Please set the environment variable {var} (.env file supported)") exit(1)