df
This commit is contained in:
parent
165e7e4a66
commit
05c1bd713b
6 changed files with 9 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
||||||
FROM ubuntu:20.04
|
FROM ubuntu:20.04
|
||||||
|
|
||||||
RUN apt update && apt -y upgrade && apt install -y python3.8 python3-pip supervisor libenchant1c2a
|
RUN apt update && apt -y upgrade && apt install -y supervisor python3-pip ffmpeg
|
||||||
|
|
||||||
COPY supervisord.conf /etc/supervisord.conf
|
COPY supervisord.conf /etc/supervisord.conf
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ class Exile(Base):
|
||||||
__tablename__ = "exiles"
|
__tablename__ = "exiles"
|
||||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||||
sub = Column(String, ForeignKey("subs.name"), primary_key=True)
|
sub = Column(String, ForeignKey("subs.name"), primary_key=True)
|
||||||
|
exiler_id = Column(Integer, ForeignKey("users.id"))
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<Exile(user_id={self.user_id}, sub={self.sub})>"
|
return f"<Exile(user_id={self.user_id}, sub={self.sub})>"
|
|
@ -17,9 +17,10 @@ import requests
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
from json import loads
|
from json import loads
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
from enchant import Dict
|
from nltk.corpus import words
|
||||||
|
|
||||||
d = Dict("en_US")
|
words = set(WORDLE_LIST) | set(words.words())
|
||||||
|
words = set([x for x in words if len(x) == 5])
|
||||||
|
|
||||||
IMGUR_KEY = environ.get("IMGUR_KEY").strip()
|
IMGUR_KEY = environ.get("IMGUR_KEY").strip()
|
||||||
|
|
||||||
|
@ -1101,7 +1102,7 @@ def handle_wordle_action(cid, v):
|
||||||
try: guess = request.values.get("guess").strip().lower()
|
try: guess = request.values.get("guess").strip().lower()
|
||||||
except: abort(400)
|
except: abort(400)
|
||||||
|
|
||||||
if len(guess) != 5 or not d.check(guess) and guess not in WORDLE_LIST:
|
if len(guess) != 5 or guess not in words:
|
||||||
return {"error": "Not a valid guess!"}, 400
|
return {"error": "Not a valid guess!"}, 400
|
||||||
|
|
||||||
if status == "active":
|
if status == "active":
|
||||||
|
|
|
@ -26,7 +26,7 @@ def exile_post(v, pid):
|
||||||
u = p.author
|
u = p.author
|
||||||
|
|
||||||
if u.admin_level < 2 and not u.exiled_from(sub):
|
if u.admin_level < 2 and not u.exiled_from(sub):
|
||||||
exile = Exile(user_id=u.id, sub=sub)
|
exile = Exile(user_id=u.id, sub=sub, exiler_id=v.id)
|
||||||
g.db.add(exile)
|
g.db.add(exile)
|
||||||
|
|
||||||
send_notification(u.id, f"@{v.username} has exiled you from /s/{sub} for [{p.title}]({p.sl})")
|
send_notification(u.id, f"@{v.username} has exiled you from /s/{sub} for [{p.title}]({p.sl})")
|
||||||
|
@ -79,7 +79,7 @@ def exile_comment(v, cid):
|
||||||
u = c.author
|
u = c.author
|
||||||
|
|
||||||
if u.admin_level < 2 and not u.exiled_from(sub):
|
if u.admin_level < 2 and not u.exiled_from(sub):
|
||||||
exile = Exile(user_id=u.id, sub=sub)
|
exile = Exile(user_id=u.id, sub=sub, exiler_id=v.id)
|
||||||
g.db.add(exile)
|
g.db.add(exile)
|
||||||
|
|
||||||
send_notification(u.id, f"@{v.username} has exiled you from /s/{sub} for [{c.permalink}]({c.sl})")
|
send_notification(u.id, f"@{v.username} has exiled you from /s/{sub} for [{c.permalink}]({c.sl})")
|
||||||
|
|
|
@ -20,7 +20,6 @@ requests
|
||||||
SQLAlchemy
|
SQLAlchemy
|
||||||
psycopg2-binary
|
psycopg2-binary
|
||||||
pusher_push_notifications
|
pusher_push_notifications
|
||||||
pyenchant
|
|
||||||
youtube-dl
|
youtube-dl
|
||||||
yattag
|
yattag
|
||||||
webptools
|
webptools
|
|
@ -1,7 +1,7 @@
|
||||||
cd /Drama
|
cd /Drama
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt -y upgrade
|
sudo apt -y upgrade
|
||||||
sudo apt -y install postgresql postgresql-contrib redis-server python3-pip gunicorn ffmpeg libenchant1c2a
|
sudo apt -y install postgresql postgresql-contrib redis-server python3-pip ffmpeg
|
||||||
cp pg_hba.conf /etc/postgresql/12/main/pg_hba.conf
|
cp pg_hba.conf /etc/postgresql/12/main/pg_hba.conf
|
||||||
sudo service postgresql restart
|
sudo service postgresql restart
|
||||||
sudo psql -U postgres -f schema.sql postgres
|
sudo psql -U postgres -f schema.sql postgres
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue