Fixed CI, reformatted code, sorted imports
This commit is contained in:
parent
94ce9fe73c
commit
a6fc06fcc7
|
@ -1,9 +1,8 @@
|
||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import shlex
|
import shlex
|
||||||
import json
|
|
||||||
import pyperclip
|
|
||||||
import webbrowser
|
import webbrowser
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from functools import partial, wraps
|
from functools import partial, wraps
|
||||||
|
@ -12,6 +11,7 @@ from tempfile import NamedTemporaryFile
|
||||||
from typing import Any, Callable, Dict, List, Optional
|
from typing import Any, Callable, Dict, List, Optional
|
||||||
|
|
||||||
import pyfzf
|
import pyfzf
|
||||||
|
import pyperclip
|
||||||
from telegram.utils import AsyncResult
|
from telegram.utils import AsyncResult
|
||||||
|
|
||||||
from arigram import config
|
from arigram import config
|
||||||
|
|
|
@ -282,7 +282,7 @@ class Model:
|
||||||
return {
|
return {
|
||||||
chat["title"]: f"{basic_info['member_count']} members",
|
chat["title"]: f"{basic_info['member_count']} members",
|
||||||
"Info": chat_info["description"],
|
"Info": chat_info["description"],
|
||||||
#"Share link": chat_info["invite_link"],
|
# "Share link": chat_info["invite_link"],
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_supergroup_info(self, chat: Dict[str, Any]) -> Dict[str, Any]:
|
def get_supergroup_info(self, chat: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
|
@ -291,11 +291,11 @@ class Model:
|
||||||
)
|
)
|
||||||
result.wait()
|
result.wait()
|
||||||
chat_info = result.update
|
chat_info = result.update
|
||||||
log.exception(str(chat_info))
|
|
||||||
return {
|
return {
|
||||||
chat["title"]: f"{chat_info['member_count']} members",
|
chat["title"]: f"{chat_info['member_count']} members",
|
||||||
"Info": chat_info["description"],
|
"Info": chat_info["description"],
|
||||||
#"Share link": chat_info["invite_link"],
|
# "Share link": chat_info["invite_link"],
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_channel_info(self, chat: Dict[str, Any]) -> Dict[str, Any]:
|
def get_channel_info(self, chat: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
|
@ -307,7 +307,7 @@ class Model:
|
||||||
return {
|
return {
|
||||||
chat["title"]: "subscribers",
|
chat["title"]: "subscribers",
|
||||||
"Info": chat_info["description"],
|
"Info": chat_info["description"],
|
||||||
#"Share link": chat_info["invite_link"],
|
# "Share link": chat_info["invite_link"],
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_secret_chat_info(self, chat: Dict[str, Any]) -> Dict[str, Any]:
|
def get_secret_chat_info(self, chat: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import json
|
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing import Any, Callable, Dict
|
from typing import Any, Callable, Dict
|
||||||
|
|
||||||
from arigram import config, utils
|
from arigram import config, utils
|
||||||
|
from arigram.config import DRAFTS_FILE
|
||||||
from arigram.controllers import Controller
|
from arigram.controllers import Controller
|
||||||
from arigram.msg import MsgProxy
|
from arigram.msg import MsgProxy
|
||||||
from arigram.config import DRAFTS_FILE
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -194,10 +194,11 @@ def update_chat_draft_message(
|
||||||
) -> None:
|
) -> None:
|
||||||
chat_id = update["chat_id"]
|
chat_id = update["chat_id"]
|
||||||
# FIXME: ignoring draft message itself for now because UI can't show it
|
# FIXME: ignoring draft message itself for now because UI can't show it
|
||||||
draft_message = update["draft_message"]["input_message_text"]["text"]["text"]
|
draft_message = update["draft_message"]["input_message_text"]["text"][
|
||||||
|
"text"
|
||||||
|
]
|
||||||
order = update["positions"][0]["order"]
|
order = update["positions"][0]["order"]
|
||||||
|
|
||||||
|
|
||||||
if not os.path.exists(DRAFTS_FILE):
|
if not os.path.exists(DRAFTS_FILE):
|
||||||
with open(DRAFTS_FILE, "w") as nf:
|
with open(DRAFTS_FILE, "w") as nf:
|
||||||
nf.write("{}")
|
nf.write("{}")
|
||||||
|
@ -212,7 +213,6 @@ def update_chat_draft_message(
|
||||||
with open(DRAFTS_FILE, "w") as wdf:
|
with open(DRAFTS_FILE, "w") as wdf:
|
||||||
json.dump(dj, wdf)
|
json.dump(dj, wdf)
|
||||||
|
|
||||||
|
|
||||||
current_chat_id = controller.model.current_chat_id
|
current_chat_id = controller.model.current_chat_id
|
||||||
if controller.model.chats.update_chat(chat_id, order=order):
|
if controller.model.chats.update_chat(chat_id, order=order):
|
||||||
controller.refresh_current_chat(current_chat_id)
|
controller.refresh_current_chat(current_chat_id)
|
||||||
|
|
13
poetry.lock
generated
13
poetry.lock
generated
|
@ -156,6 +156,14 @@ python-versions = "*"
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
plumbum = "*"
|
plumbum = "*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pyperclip"
|
||||||
|
version = "1.8.2"
|
||||||
|
description = "A cross-platform clipboard module for Python. (Only handles plain text for now.)"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = "*"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pypiwin32"
|
name = "pypiwin32"
|
||||||
version = "223"
|
version = "223"
|
||||||
|
@ -218,7 +226,7 @@ python-versions = ">=3.6"
|
||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "1.1"
|
lock-version = "1.1"
|
||||||
python-versions = "^3.8"
|
python-versions = "^3.8"
|
||||||
content-hash = "327722354091af1dbf3712b1673fc07f68c0e4d4293aac7c8c9733069d1503c8"
|
content-hash = "061484270c70aa1136531e656408afb105e5d532473e9a642961595878ecbde9"
|
||||||
|
|
||||||
[metadata.files]
|
[metadata.files]
|
||||||
appdirs = [
|
appdirs = [
|
||||||
|
@ -296,6 +304,9 @@ pyfzf = [
|
||||||
{file = "pyfzf-0.2.2-py3-none-any.whl", hash = "sha256:1f324717fcae6746c05094be09b36f45412f0965b2d718c8d2352877ae20df69"},
|
{file = "pyfzf-0.2.2-py3-none-any.whl", hash = "sha256:1f324717fcae6746c05094be09b36f45412f0965b2d718c8d2352877ae20df69"},
|
||||||
{file = "pyfzf-0.2.2.tar.gz", hash = "sha256:8a35234fd6b3d6abca2b9971c5b27e157cfd878ee3ee9f707ddf6373438ad541"},
|
{file = "pyfzf-0.2.2.tar.gz", hash = "sha256:8a35234fd6b3d6abca2b9971c5b27e157cfd878ee3ee9f707ddf6373438ad541"},
|
||||||
]
|
]
|
||||||
|
pyperclip = [
|
||||||
|
{file = "pyperclip-1.8.2.tar.gz", hash = "sha256:105254a8b04934f0bc84e9c24eb360a591aaf6535c9def5f29d92af107a9bf57"},
|
||||||
|
]
|
||||||
pypiwin32 = [
|
pypiwin32 = [
|
||||||
{file = "pypiwin32-223-py3-none-any.whl", hash = "sha256:67adf399debc1d5d14dffc1ab5acacb800da569754fafdc576b2a039485aa775"},
|
{file = "pypiwin32-223-py3-none-any.whl", hash = "sha256:67adf399debc1d5d14dffc1ab5acacb800da569754fafdc576b2a039485aa775"},
|
||||||
{file = "pypiwin32-223.tar.gz", hash = "sha256:71be40c1fbd28594214ecaecb58e7aa8b708eabfa0125c8a109ebd51edbd776a"},
|
{file = "pypiwin32-223.tar.gz", hash = "sha256:71be40c1fbd28594214ecaecb58e7aa8b708eabfa0125c8a109ebd51edbd776a"},
|
||||||
|
|
6
setup.py
6
setup.py
|
@ -23,5 +23,9 @@ setup(
|
||||||
packages=["arigram"],
|
packages=["arigram"],
|
||||||
entry_points={"console_scripts": ["arigram = arigram.__main__:main"]},
|
entry_points={"console_scripts": ["arigram = arigram.__main__:main"]},
|
||||||
python_requires=">=3.8",
|
python_requires=">=3.8",
|
||||||
install_requires=["python-telegram>=0.15.0", "pyfzf>=0.2.2", "pyperclip>=1.8.2"],
|
install_requires=[
|
||||||
|
"python-telegram>=0.15.0",
|
||||||
|
"pyfzf>=0.2.2",
|
||||||
|
"pyperclip>=1.8.2",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue