From 9d02216c831cd5f965b82f3a3a5ffb2a3252629c Mon Sep 17 00:00:00 2001 From: samie1232314 <147721188+samie1232314@users.noreply.github.com> Date: Thu, 2 Nov 2023 10:43:19 +0330 Subject: [PATCH 1/3] Update main.py --- main.py | 73 ++++++++++++++++++++++++++++++--------------------------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/main.py b/main.py index 1014f49f8c5..a2181877c60 100644 --- a/main.py +++ b/main.py @@ -1,34 +1,39 @@ -import logging -import logging.handlers -import os - -import requests - -logger = logging.getLogger(__name__) -logger.setLevel(logging.DEBUG) -logger_file_handler = logging.handlers.RotatingFileHandler( - "status.log", - maxBytes=1024 * 1024, - backupCount=1, - encoding="utf8", -) -formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") -logger_file_handler.setFormatter(formatter) -logger.addHandler(logger_file_handler) - -try: - SOME_SECRET = os.environ["SOME_SECRET"] -except KeyError: - SOME_SECRET = "Token not available!" - #logger.info("Token not available!") - #raise - - -if __name__ == "__main__": - logger.info(f"Token value: {SOME_SECRET}") - - r = requests.get('https://weather.talkpython.fm/api/weather/?city=Berlin&country=DE') - if r.status_code == 200: - data = r.json() - temperature = data["forecast"]["temp"] - logger.info(f'Weather in Berlin: {temperature}') \ No newline at end of file +from pyrogram import Client, filters +from pyrogram import enums + + +api_id = 23136380 +api_hash = "6ae6541159e229499615953de667675c" + +#---------config--------------# +tagchaneel = "-1002008420751" +idchannel = "-1002008420751" +channel = [-1002008420751] +#-----------------------------# + +app = Client("copy" , api_id , api_hash) + +@app.on_message(filters.text & filters.me) +async def mes_handler(client, message): + + chatid = message.chat.id + text = message.text + + if text == "help": + await message.reply_text('`انلاینم!🦦`') + +@app.on_message(filters.text & filters.chat(channel)) +async def mes_handler(client, message): + + chatid = message.chat.id + text = message.text + + if 'vlass://' in text or 'vmess://' in text or 'ss://' in text or 'trojan://' in text: + text1 = '`{text}`' + '\n' + tagchaneel + await app.send_message(idchannel, text) + + + + + +app.run() From fc751a7c83c589fdf8dc3b388b60366a2e3c00b9 Mon Sep 17 00:00:00 2001 From: samie1232314 <147721188+samie1232314@users.noreply.github.com> Date: Thu, 2 Nov 2023 10:44:23 +0330 Subject: [PATCH 2/3] Create python-app.yml --- .github/workflows/python-app.yml | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/python-app.yml diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 00000000000..f3d4fca8900 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,39 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python application + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest From e6d923ffece7d49c4880bf2b97e92f4a7c988656 Mon Sep 17 00:00:00 2001 From: samie1232314 <147721188+samie1232314@users.noreply.github.com> Date: Thu, 2 Nov 2023 10:50:48 +0330 Subject: [PATCH 3/3] Update python-app.yml --- .github/workflows/python-app.yml | 66 ++++++++++++++++---------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index f3d4fca8900..790318fdacb 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -1,39 +1,41 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python - -name: Python application +name: run main.py on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -permissions: - contents: read + schedule: + - cron: '0 0 * * 1' # At 00:00 on Monday jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.10 - uses: actions/setup-python@v3 - with: - python-version: "3.10" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - pytest + + - name: checkout repo content + uses: actions/checkout@v2 # checkout the repository content to github runner + + - name: setup python + uses: actions/setup-python@v4 + with: + python-version: '3.9' # install the python version needed + + - name: install python packages + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: execute py script # run main.py + env: + SOME_SECRET: ${{ secrets.SOME_SECRET }} + run: python main.py + + - name: commit files + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add -A + git diff-index --quiet HEAD || (git commit -a -m "updated logs" --allow-empty) + + - name: push changes + uses: ad-m/github-push-action@v0.6.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: main