|
@@ -1,6 +1,7 @@
|
|
|
import atexit
|
|
|
from logging.config import dictConfig
|
|
|
from threading import Thread
|
|
|
+import random
|
|
|
|
|
|
from flask import Flask, request
|
|
|
import requests
|
|
@@ -44,6 +45,27 @@ def post_groupme_message(msg, group_id):
|
|
|
)
|
|
|
|
|
|
|
|
|
+sponsor_count = -1
|
|
|
+sponsors = [
|
|
|
+ ("RAID: Shadow Legends - the hot new mobile game with over a billion players", "RAIDBOT"),
|
|
|
+ ("Raycon Earbuds - the best true wireless earbuds that sponsor Rollbot", "ROLLBUDS"),
|
|
|
+ ("Audible dot com - sign up today for a free license to view an eBook", "READBOT"),
|
|
|
+ ("Casper Mattresses - the beds are haunted, actually haunted! How is that allowed?", "ROLLBED"),
|
|
|
+ ("MeUndies - think about rollbot but on your junk", "ROLLBOXERS I guess"),
|
|
|
+ ("PepsiCo Products - the refreshing taste of PepsiCo products", "Sinaltrainal v. Coca-Cola Co."),
|
|
|
+ ("RAIDCON Shadow Buds - nightmare nightmare nightmare nightmare", "nightmarenightmarenightmare"),
|
|
|
+]
|
|
|
+
|
|
|
+
|
|
|
+def post_sponsored(msg, group_id):
|
|
|
+ global sponsor_count
|
|
|
+ if random.randint(1, 3) == 3:
|
|
|
+ sponsor_count += 1
|
|
|
+ (sponsor, code) = sponsors[sponsor_count] if sponsor_count < len(sponsors) else random.choice(sponsors)
|
|
|
+ post_groupme_message(f"This action was sponsored by {sponsor}! Use code {code} for {random.choice([10, 15, 25])}% off!", group_id)
|
|
|
+ post_groupme_message(msg, group_id)
|
|
|
+
|
|
|
+
|
|
|
app = Flask(__name__)
|
|
|
app.config["PROPAGATE_EXCEPTIONS"] = True
|
|
|
rollbot = Rollbot(
|
|
@@ -52,7 +74,7 @@ rollbot = Rollbot(
|
|
|
aliases=get_config("aliases"),
|
|
|
responses=get_config("responses"),
|
|
|
sleep_time=float(get_config("sleep_time")),
|
|
|
- callback=post_groupme_message,
|
|
|
+ callback=post_sponsored,
|
|
|
session_factory=db.Session
|
|
|
)
|
|
|
app.logger.info("Initializing database tables")
|