aboutsummaryrefslogtreecommitdiff
path: root/bot.py
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2020-06-19 01:02:51 -0600
committerMelody Horn <melody@boringcactus.com>2020-06-19 01:02:51 -0600
commit672f3edd7aabe124b9075b50da9bbb85684bd86c (patch)
tree147a6470aed9943faf8117721ea9a5e06f118078 /bot.py
parent7397e9fc78c42f49abe4e5acda42ac26698d3be2 (diff)
downloadcrabravebot-672f3edd7aabe124b9075b50da9bbb85684bd86c.tar.gz
crabravebot-672f3edd7aabe124b9075b50da9bbb85684bd86c.zip
load app name from heroku automatically
Diffstat (limited to 'bot.py')
-rw-r--r--bot.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/bot.py b/bot.py
index e7b794f..d4fc88f 100644
--- a/bot.py
+++ b/bot.py
@@ -144,11 +144,11 @@ def start(update: telegram.Update, context: CallbackContext):
To shitpost, type @{me} and type the text you want to overlay over crab rave.
This was originally made by @boringcactus in one afternoon when ze was bored.
This bot isn't super reliable but the source is at https://github.com/boringcactus/crabravebot,
-and you can use this bot from the Web at https://crabravebot.herokuapp.com/"""
+and you can use this bot from the Web at https://{name}.herokuapp.com/"""
you = update.effective_user.first_name
if you is None or len(you) == 0:
you = update.effective_user.username
- text = template.format(you=you, me=context.bot.username)
+ text = template.format(you=you, me=context.bot.username, name=os.environ.get('HEROKU_APP_NAME', 'crabravebot'))
context.bot.send_message(chat_id=update.effective_chat.id, text=text)
@@ -159,7 +159,7 @@ def inline_query(update: telegram.Update, context: CallbackContext):
logger.info('Got query %s', text)
def make_result(style: Style):
- base = "https://crabravebot.herokuapp.com/render?v=1&style=" + style.id + "&text=" + url_quote(text, safe='')
+ base = "https://" + os.environ.get('HEROKU_APP_NAME', 'crabravebot') + ".herokuapp.com/render?v=1&style=" + style.id + "&text=" + url_quote(text, safe='')
return telegram.InlineQueryResultVideo(
id=style.id,
video_url=base + '&ext=mp4',
@@ -213,7 +213,7 @@ def webhook():
bot = telegram.Bot(token=TOKEN)
-bot.set_webhook('https://crabravebot.herokuapp.com' + WEBHOOK)
+bot.set_webhook('https://' + os.environ.get('HEROKU_APP_NAME', 'crabravebot') + '.herokuapp.com' + WEBHOOK)
update_queue = Queue()
dp = Dispatcher(bot, update_queue, use_context=True)
# Add handlers