Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/build.yml
#	.github/workflows/codesee-arch-diagram.yml
#	.github/workflows/python-publish.yml
#	README.md
#	gramup/__init__.py
#	gramup/__main__.py
#	gramup/backup.py
#	gramup/login.py
#	gramup/restore.py
#	gramup/search.py
#	gramup/settings.py
#	gramup/utils.py
#	setup.py
  • Loading branch information
rohittp0 committed Jun 3, 2023
2 parents bd58c0d + 081afbd commit c045e9a
Show file tree
Hide file tree
Showing 19 changed files with 293 additions and 21 deletions.
85 changes: 85 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

## Pull Request Process

1. Ensure that all the changes you have made works properly when installing the project using `pip`.
2. Update the or create the currosponding documentation file in doc folder to include your change.
3. Increase the version numbers in any examples files and the README.md to the new version that this Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you.

## Code of Conduct

### Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

### Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

### Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

### Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

### Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

### Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
13 changes: 13 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: rohittp0
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Contributing
about: Describe something you want to work on
title: ''
labels: contribution
assignees: rohittp0

---

**Description**
Please describe the contribution you are proposing. What problem does it solve? How does it improve the project?

**Motivation and Context**
Why are you proposing this contribution? What inspired you to make this change? How does it fit into the larger goals of the project?

**Possible Implementation**
Please describe how you plan to implement your contribution. What technologies or tools will you use? Are there any potential challenges you foresee?

**Additional Information**
Is there any additional information that may be helpful for the project maintainers to know about your proposed contribution? Are there any questions or concerns you would like to discuss?

**Checklist**
Please check off the following items to ensure that your issue is complete:

- [ ] I have thoroughly researched and tested my proposed contribution.
- [ ] I have reviewed the project's guidelines for contributions and ensured that my proposed contribution aligns with them.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
29 changes: 29 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Summary
<!--- Provide a general summary of your changes -->

## Description
<!--- Describe your changes in detail -->

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## How has this been tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, tests ran to see how -->
<!--- your change affects other areas of the code, etc. -->

## Screenshots (if appropriate):

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
13 changes: 0 additions & 13 deletions .github/workflows/greetings.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Pylint

on: [push]
on: [push, pull_request]

jobs:
lint:
Expand All @@ -9,10 +9,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10.0
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.10.0
python-version: 3.8
- uses: actions/cache@v2
with:
path: ~/.cache/pip
Expand Down
21 changes: 21 additions & 0 deletions docs/login/get_chat_id.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Get the chat id (MAIN)
This function prompts the user to send 'use this chat' message and obtaisns the chat id of the chat where the message was sent.
## Parameters
- client : (TelegramClient) Client object to be used for login.

- phone number : (str) Phone number of the user.

- back up folders : (list) List of folders to be backed up.
## Returns
db_dict["chat_id"]
- chat_id : (int) Chat id of the chat where the message was sent.

# Messsage Handler
This is that message handler that is called when a new message is received.
It checks if the message contains required keywords and saves the chat id of the chat it received the message from. It also sends an acknowledgement to the same chat as well.

## Parameters
- update : It is the update object that is passed to the message handler.

## Returns
None
10 changes: 10 additions & 0 deletions docs/login/load_data.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Load data
This function tries to read phone number, chat id and list of backup
folders from DATA_FILE. If they are not found it prompts user to enter them.
## Returns
Returns the following tuple (phone_number, chat_id, backup_folders)
- phone_number : (str) Phone number of the user

- chat_id : (int) Chat id of the chat to be used for backup

- backup_folders : (list) List of folders to be backed up
10 changes: 10 additions & 0 deletions docs/login/login.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Login
This function creates and authenticates Telegram client and calls the call_back with Telegram client, phone no and chat id as arguments.
## Parameters
None
## Returns
- tg_client : (TelegramClient) Telegram client object.

- phone_number : (str) Phone number of the user.
- chat_id : (int) Chat id of the chat where the message was sent.
15 changes: 15 additions & 0 deletions docs/login/try_login_with_code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Try login with code
This function is used to login to Telegram using the code sent to the user's phone number.
- It asks for the OTP max_tries times before giving up.

- If the OTP is correct it returns the client object.

- If the OTP is incorrect it returns None.
## Parameters
- client : (TelegramClient) Client object to be used for login.

- max_tries : (int) Maximum number of tries to enter OTP.

- tries : (int) Number of tries to enter OTP
## Returns
None - If the OTP is incorrect.
1 change: 1 addition & 0 deletions gramup/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@
DATA_FILE = join(GRAMUP_DIR, "saved")
CACHE_DIR = join(FILES_DIR, "database")
LOG_FILE = join(GRAMUP_DIR, "log.txt")
GRAM_IGNORE = join(GRAMUP_DIR, ".gram_ignore")
OTHER_FOLDER = "Other"
1 change: 1 addition & 0 deletions icons/envelope-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/instagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/stack-overflow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/youtube.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
speedtest-cli
python-telegram
enquiries~=0.1.0

setuptools~=57.0.0
blessings==1.7
curtsies==0.3.10
cwcwidth==0.1.5
enquiries==0.1.0
python-telegram==0.14.0
six==1.16.0
speedtest-cli==2.1.3

0 comments on commit c045e9a

Please sign in to comment.