|
@@ -5,6 +5,7 @@ import random
|
|
|
|
|
|
from flask import Flask, request
|
|
|
import requests
|
|
|
+import requests.exceptions
|
|
|
|
|
|
from rollbot import Rollbot, RollbotMessage, RollbotPlugin
|
|
|
|
|
@@ -35,15 +36,19 @@ dictConfig({
|
|
|
|
|
|
def post_groupme_message(msg, group_id):
|
|
|
bot_id = BOTS_LOOKUP[group_id]
|
|
|
- requests.post(
|
|
|
- "https://api.groupme.com/v3/bots/post",
|
|
|
- json={
|
|
|
- "bot_id": bot_id,
|
|
|
- "text": msg
|
|
|
- },
|
|
|
- timeout=10
|
|
|
- )
|
|
|
-
|
|
|
+ try:
|
|
|
+ requests.post(
|
|
|
+ "https://api.groupme.com/v3/bots/post",
|
|
|
+ json={
|
|
|
+ "bot_id": bot_id,
|
|
|
+ "text": msg
|
|
|
+ },
|
|
|
+ timeout=10
|
|
|
+ )
|
|
|
+ except requests.exceptions.Timeout as t:
|
|
|
+ app.logger.error(f"GroupMe timed out sending {msg} as {bot_id}", exc_info=t)
|
|
|
+ except requests.exceptions.HTTPError as h:
|
|
|
+ app.log_exception(h)
|
|
|
|
|
|
sponsor_count = -1
|
|
|
sponsors = [
|