Easy development

This commit is contained in:
polyfloyd 2023-04-18 22:39:01 +02:00
parent ee24c7c18f
commit 9c13206c30
3 changed files with 12 additions and 9 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/.direnv
/.envrc

15
main.py Normal file → Executable file
View file

@ -1,11 +1,6 @@
#!/usr/bin/env python3
# Bitlair HobbyBot # Bitlair HobbyBot
#
# Requirements:
# - pytz
# - python3
# - discord_webhook
# - paho-mqtt
# - discord.py
from time import sleep from time import sleep
from string import Template from string import Template
@ -16,9 +11,10 @@ import datetime
import pytz import pytz
import paho.mqtt.client as mqtt import paho.mqtt.client as mqtt
import paho.mqtt.subscribe as subscribe import paho.mqtt.subscribe as subscribe
import os
# hunter2 # hunter2
token = "" token = os.getenv('DISCORD_TOKEN')
webhook_url = "" webhook_url = ""
description = 'Bitlair Bot' description = 'Bitlair Bot'
state_template = Template('$topic is now $state') state_template = Template('$topic is now $state')
@ -30,6 +26,7 @@ intents.message_content = True
intents.members = True intents.members = True
HobbyBot = commands.Bot(command_prefix='!', description=description, intents=intents) HobbyBot = commands.Bot(command_prefix='!', description=description, intents=intents)
# Define bot commands # Define bot commands
@HobbyBot.event @HobbyBot.event
async def on_ready(): async def on_ready():
@ -115,4 +112,4 @@ client.loop_start()
HobbyBot.run(token) HobbyBot.run(token)
# Exit when bot crashes # Exit when bot crashes
client.loop_stop(force=True) client.loop_stop(force=True)

4
requirements.txt Normal file
View file

@ -0,0 +1,4 @@
discord.py
discord_webhook
paho-mqtt
pytz