")
-@limiter.limit("1/second;30/minute;200/hour;1000/day")
-@auth_required
-def handle_wordle_action(cid, v):
-
- comment = get_comment(cid)
-
- guesses, status, answer = comment.wordle_result.split("_")
- count = len(guesses.split(" -> "))
-
- try: guess = request.values.get("thing").strip().lower()
- except: abort(400)
-
- if len(guess) != 5 or not d.check(guess) and guess not in WORDLE_LIST:
- return {"error": "Not a valid guess!"}, 400
-
- if status == "active":
- guesses += "".join(cg + WORDLE_COLOR_MAPPINGS[diff] for cg, diff in zip(guess, diff_words(answer, guess)))
-
- if (guess == answer): status = "won"
- elif (count == 6): status = "lost"
- else: guesses += ' -> '
-
- comment.wordle_result = f'{guesses}_{status}_{answer}'
-
- g.db.add(comment)
- g.db.commit()
-
- return {"response" : comment.wordle_html(v)}
diff --git a/files/routes/posts.py b/files/routes/posts.py
index f99b51512..823079346 100644
--- a/files/routes/posts.py
+++ b/files/routes/posts.py
@@ -5,7 +5,6 @@ from files.helpers.sanitize import *
from files.helpers.alerts import *
from files.helpers.discord import send_discord_message, send_cringetopia_message
from files.helpers.const import *
-from files.helpers.slots import *
from files.classes import *
from flask import *
from io import BytesIO
@@ -209,9 +208,7 @@ def post_id(pid, anything=None, v=None, sub=None):
elif sort == "bottom":
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
- first = [c[0] for c in comments.filter(or_(and_(Comment.slots_result == None, Comment.blackjack_result == None, Comment.wordle_result == None), func.length(Comment.body_html) > 100)).all()]
- second = [c[0] for c in comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None, Comment.wordle_result != None), func.length(Comment.body_html) <= 100).all()]
- comments = first + second
+ comments = [c[0] for c in comments.all()]
else:
pinned = g.db.query(Comment).filter(Comment.parent_submission == post.id, Comment.is_pinned != None).all()
@@ -228,9 +225,7 @@ def post_id(pid, anything=None, v=None, sub=None):
elif sort == "bottom":
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
- first = comments.filter(or_(and_(Comment.slots_result == None, Comment.blackjack_result == None, Comment.wordle_result == None), func.length(Comment.body_html) > 100)).all()
- second = comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None, Comment.wordle_result != None), func.length(Comment.body_html) <= 100).all()
- comments = first + second
+ comments = comments.all()
offset = 0
ids = set()
@@ -344,9 +339,7 @@ def viewmore(v, pid, sort, offset):
elif sort == "bottom":
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
- first = [c[0] for c in comments.filter(or_(and_(Comment.slots_result == None, Comment.blackjack_result == None, Comment.wordle_result == None), func.length(Comment.body_html) > 100)).all()]
- second = [c[0] for c in comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None, Comment.wordle_result != None), func.length(Comment.body_html) <= 100).all()]
- comments = first + second
+ comments = [c[0] for c in comments.all()]
else:
comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == pid, Comment.level == 1, Comment.is_pinned == None, Comment.id.notin_(ids))
@@ -360,10 +353,8 @@ def viewmore(v, pid, sort, offset):
comments = comments.order_by(Comment.realupvotes.desc())
elif sort == "bottom":
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
-
- first = comments.filter(or_(and_(Comment.slots_result == None, Comment.blackjack_result == None, Comment.wordle_result == None), func.length(Comment.body_html) > 100)).all()
- second = comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None, Comment.wordle_result != None), func.length(Comment.body_html) <= 100).all()
- comments = first + second
+
+ comments = comments.all()
comments = comments[offset:]
comments2 = []
diff --git a/files/templates/comments.html b/files/templates/comments.html
index 3ea48357d..a402743a6 100644
--- a/files/templates/comments.html
+++ b/files/templates/comments.html
@@ -219,18 +219,6 @@
{% if c.edited_utc %}
· Edited {{c.edited_string}}
{% endif %}
-
- {% if c.slots_result %}
- {{c.slots_result}}
- {% endif %}
-
- {% if c.blackjack_result %}
- {{c.blackjack_html(v) | safe}}
- {% endif %}
-
- {% if c.wordle_result %}
- {{c.wordle_html(v) | safe}}
- {% endif %}
{% if v and c.filter_state == 'reported' and v.can_manage_reports() %}
diff --git a/migrations/versions/2022_09_05_08_41_14_44a40481ca2b_remove_games_from_comments.py b/migrations/versions/2022_09_05_08_41_14_44a40481ca2b_remove_games_from_comments.py
new file mode 100644
index 000000000..9a652dd74
--- /dev/null
+++ b/migrations/versions/2022_09_05_08_41_14_44a40481ca2b_remove_games_from_comments.py
@@ -0,0 +1,32 @@
+"""remove games from comments
+
+Revision ID: 44a40481ca2b
+Revises: c217c608d86c
+Create Date: 2022-09-05 08:41:14.982682+00:00
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = '44a40481ca2b'
+down_revision = 'c217c608d86c'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.drop_column('comments', 'slots_result')
+ op.drop_column('comments', 'blackjack_result')
+ op.drop_column('comments', 'wordle_result')
+ # ### end Alembic commands ###
+
+
+def downgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.add_column('comments', sa.Column('wordle_result', sa.VARCHAR(length=115), autoincrement=False, nullable=True))
+ op.add_column('comments', sa.Column('blackjack_result', sa.VARCHAR(length=860), autoincrement=False, nullable=True))
+ op.add_column('comments', sa.Column('slots_result', sa.VARCHAR(length=32), autoincrement=False, nullable=True))
+ # ### end Alembic commands ###
diff --git a/requirements.txt b/requirements.txt
index 76f9e27e9..7d7385a01 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -24,7 +24,6 @@ SQLAlchemy
user-agents
psycopg2-binary
pusher_push_notifications
-pyenchant
youtube-dl
yattag
webptools