mirror of https://gitlab.com/ceda_ei/Nukist-Bot
Add sample config, gitignore, base template
This commit is contained in:
parent
6e42868656
commit
e11a0e17aa
|
@ -0,0 +1,2 @@
|
||||||
|
config.py
|
||||||
|
__pycache__/
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import config
|
||||||
|
import logging
|
||||||
|
from telegram.ext import Updater, CommandHandler
|
||||||
|
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - \
|
||||||
|
%(message)s', level=logging.INFO)
|
||||||
|
|
||||||
|
|
||||||
|
def nuke(bot, update):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
updater = Updater(token=config.api_key)
|
||||||
|
dispatcher = updater.dispatcher
|
||||||
|
nuke_handler = CommandHandler('nuke', nuke)
|
||||||
|
dispatcher.add_handler(nuke_handler)
|
||||||
|
|
||||||
|
if config.update_method == "polling":
|
||||||
|
updater.start_polling()
|
||||||
|
elif config.update_method == "webhook":
|
||||||
|
updater.start_webhook(listen=config.webhook["listen"],
|
||||||
|
url_path=config.webhook["url_path"],
|
||||||
|
port=config.webhook["port"])
|
||||||
|
updater.bot.set_webhook(url=config.webhook["url"])
|
|
@ -0,0 +1,17 @@
|
||||||
|
# Create a new bot by messaging @BotFather and follow the instructions
|
||||||
|
# Replace the key by the actual token recieved from BotFather
|
||||||
|
api_key = "123456789:xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
|
||||||
|
# Update method
|
||||||
|
# Available Modes: "polling", "webhook"
|
||||||
|
update_method = "polling"
|
||||||
|
|
||||||
|
# Webhook Config
|
||||||
|
# Check the following urls for more details
|
||||||
|
# https://github.com/python-telegram-bot/python-telegram-bot/wiki/Webhooks
|
||||||
|
|
||||||
|
webhook = {"listen": "0.0.0.0",
|
||||||
|
"url": "https://example.com/" + api_key,
|
||||||
|
"url_path": api_key,
|
||||||
|
"port": 9999,
|
||||||
|
}
|
Loading…
Reference in New Issue