Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge dev into master #2497

Merged
merged 4 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions alembic/versions/881e7b1dba8a_track_telegram_messages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""track telegram messages

Revision ID: 881e7b1dba8a
Revises: 664f8a93794e
Create Date: 2023-11-21 12:39:32.931262

"""

# revision identifiers, used by Alembic.
revision = '881e7b1dba8a'
down_revision = '664f8a93794e'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa

def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('telegram_forwarded_messages',
sa.Column('message_id', sa.String(), nullable=True),
sa.Column('newsflash_id', sa.Integer(), nullable=False),
sa.Column('group_sent', sa.String(), nullable=False),
sa.PrimaryKeyConstraint('message_id')
)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('telegram_forwarded_messages')
# ### end Alembic commands ###
8 changes: 8 additions & 0 deletions anyway/flask_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,14 @@ def embedded_reports_api():
return response


@app.route("/api/telegram/webhook", methods=["POST"])
def telegram_webhook():
update = request.json # Telegram sends updates in JSON format
logging.info(f"Received Telegram update: {update}")

return jsonify(success=True)


# User system API
app.add_url_rule("/user/add_role", view_func=add_role, methods=["POST"])
app.add_url_rule(
Expand Down
6 changes: 6 additions & 0 deletions anyway/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2975,3 +2975,9 @@ class TelegramGroups(TelegramGroupsBase):

class TelegramGroupsTest(TelegramGroupsBase):
__tablename__ = "telegram_groups_test"

class TelegramForwardedMessages():
__tablename__ = 'telegram_forwarded_messages'
message_id = Column(String(), primary_key=True)
newsflash_id = Column(BigInteger(), nullable=False)
group_sent = Column(String(), nullable=False),
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ rauth==0.7.3
rcssmin==1.0.6
requests==2.31.0
tweepy==3.8.0
urllib3==1.26.17
urllib3==1.26.18
webassets==2.0
xlrd==2.0.1
lxml==4.9.1
Expand Down
Loading