Skip to content

Commit

Permalink
add some option
Browse files Browse the repository at this point in the history
add view counts for delete option
add requirments to setup.py
add requirments.txt file
  • Loading branch information
bistcuite committed Sep 24, 2021
1 parent c1a9707 commit a862780
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Eitaa PyKit
This repo contains a simple library for work with [Eitaa](https://eitaa.com/) messenger's api

PyPI Page : [https://pypi.org/project/Eitaa-PyKit](https://pypi.org/project/Eitaa-PyKit/)

## Install
```
pip install eitaapykit
Expand Down
17 changes: 10 additions & 7 deletions eitaa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,31 @@ def get_info(channel_id):
}
return result

def send_message(token,chat_id,text,pin=False):
def send_message(token,chat_id,text,pin=False,view_delete=-1):
r = requests.post(
f"https://eitaayar.ir/api/{token}/sendMessage",
data = {
'chat_id' : chat_id,
'text' : text,
'pin' : int(pin)
'pin' : int(pin),
'viewCountForDelete' : view_delete,
}
)
return bool(r.json()['ok'])
if bool(r.json()['ok']) : return True
else : return r.json()

def send_file(token,chat_id,caption,file,pin=False):
def send_file(token,chat_id,caption,file,pin=False,view_delete=-1):
r = requests.post(
f"https://eitaayar.ir/api/{token}/sendFile",
data = {
'chat_id' : chat_id,
'caption' : caption,
'pin' : int(pin)
'pin' : int(pin),
'viewCountForDelete' : view_delete,
},
files={
'file': open(file,'rb'),
}
)
print(r.json())
return bool(r.json()['ok'])
if bool(r.json()['ok']) : return True
else : return r.json()
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
requests
bs4
16 changes: 13 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
from distutils.core import setup

with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()

setup (
name='Eitaa PyKit',
version='1.0',
packages=['eitaa'],
name='Eitaa PyKit',
version='1.1',
packages=['eitaa'],
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/bistcuite/eitaapykit",
install_requires=[
'requests',
'bs4'
]
)

0 comments on commit a862780

Please sign in to comment.