From 9c13206c307d0083ef222e9b1a9536cc005061cf Mon Sep 17 00:00:00 2001 From: polyfloyd Date: Tue, 18 Apr 2023 22:39:01 +0200 Subject: [PATCH] Easy development --- .gitignore | 2 ++ main.py | 15 ++++++--------- requirements.txt | 4 ++++ 3 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 .gitignore mode change 100644 => 100755 main.py create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..973c04b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/.direnv +/.envrc diff --git a/main.py b/main.py old mode 100644 new mode 100755 index bef21f4..5f21244 --- a/main.py +++ b/main.py @@ -1,11 +1,6 @@ +#!/usr/bin/env python3 + # Bitlair HobbyBot -# -# Requirements: -# - pytz -# - python3 -# - discord_webhook -# - paho-mqtt -# - discord.py from time import sleep from string import Template @@ -16,9 +11,10 @@ import datetime import pytz import paho.mqtt.client as mqtt import paho.mqtt.subscribe as subscribe +import os # hunter2 -token = "" +token = os.getenv('DISCORD_TOKEN') webhook_url = "" description = 'Bitlair Bot' state_template = Template('$topic is now $state') @@ -30,6 +26,7 @@ intents.message_content = True intents.members = True HobbyBot = commands.Bot(command_prefix='!', description=description, intents=intents) + # Define bot commands @HobbyBot.event async def on_ready(): @@ -115,4 +112,4 @@ client.loop_start() HobbyBot.run(token) # Exit when bot crashes -client.loop_stop(force=True) \ No newline at end of file +client.loop_stop(force=True) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..a73e5dd --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +discord.py +discord_webhook +paho-mqtt +pytz