Skip to content

Commit

Permalink
to prod
Browse files Browse the repository at this point in the history
  • Loading branch information
SivikGosh committed Feb 5, 2024
1 parent 67516a9 commit 9d13c07
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
API_ID=1234567890
API_HASH='1qazxsw23edcvfr45tgbnhy67ujmki89olp0'
SRC_CHAT_ID='1234567890'
SRC_CHAT_ID='1234567890'
TARGET_CHAT_ID='0987654321'
3 changes: 1 addition & 2 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ WORKDIR /app

COPY . .

RUN pip install --upgrade pip \
pip install -r requirements.txt
RUN pip install --upgrade pip && pip install -r requirements.txt

ENTRYPOINT [ "python", "main.py" ]
11 changes: 3 additions & 8 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

api_id = os.getenv('API_ID')
api_hash = os.getenv('API_HASH')
app = Client("my_account", api_id, api_hash)
app = Client('parser', api_id, api_hash)


# def main():
Expand Down Expand Up @@ -53,7 +53,7 @@

@app.on_message()
def test(client, message):
if (message.chat.id == int(os.getenv('SRC_CHAT_ID'))):
if (message.chat.id == int(os.getenv('SRC_CHAT_ID'))) and ('#нужно' in message.text):
try:
lower_mes = message.text.lower()
except AttributeError:
Expand All @@ -68,15 +68,10 @@ def test(client, message):
sett = set(alias + build)
if len(sett.intersection(mes)) > 1:
client.forward_messages(
'me',
int(os.getenv('TARGET_CHAT_ID')),
from_chat_id=os.getenv('SRC_CHAT_ID'),
message_ids=message.id
)
client.forward_messages(
'me',
from_chat_id=int(os.getenv('SRC_CHAT_ID')),
message_ids=message.id
)


app.run()

0 comments on commit 9d13c07

Please sign in to comment.