diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 00000000000..790318fdacb --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,41 @@ +name: run main.py + +on: + schedule: + - cron: '0 0 * * 1' # At 00:00 on Monday + +jobs: + build: + runs-on: ubuntu-latest + steps: + + - 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 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()