Getting started is easy. Follow the directions below to get GramAddict installed and check out the example configs to get rolling.
- Python 3.6+ (3.10 currently not supported!)
- PIP
- ADB
- Only devices with Android 4.4+ (SDK 19) are supported. There are a few emulators you can use instead: google for them. e.g. Memu, LDPlayer, Android Studio and so on.
- Your Instagram app must be in English https://help.instagram.com/111923612310997
1. Download the latest's supported Python 3 release.
- As of the time of this writing, the latest version is 3.9.7.
- Install launcher for all users
- Add Python 3.9 to PATH
- (If prompted) Disable path length limit
python –V
or
python3 –V
Your machine may have multiple versions of Python installed, depending on which is selected by default you would have to use python
OR python3
later on, based on the results of version check commands from the above. Remember that the version must be 3.6+
pip3 -V
If it is not installed, download get-pip.py (right click on the link -> save as) and run python get-pip.py
from the same folder where you just downloaded the file.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install python
python3 –V && pip3 -V
On Linux Python is pre-installed.
For Raspberry the pre-installed version should be 3.6. Check this out by running this command: python3 -V
If you have a lover version of Python, google for how to upgrade.
There are two ways to install GramAddict. Via git
or via pip
. If you plan on modifying code, contributing, being a beta tester, or otherwise inspecting the code. You should install GramAddict with git
. Otherwise, you should install it with pip
.
We recommend installing with pip
for the average user.
Regardless of which method you use, if you are familiar with virtualenv
or if you plan on using/developing other python scripts, we recommend that you set up a virtual environment.
- Create a new folder in the directory of your choice. A recommendation would be in your user folder or documents folder.
- Go into that folder:
cd gramaddict
- (Optionally) Use virtualenv or similar to make a virtual environment
virtualenv -p python3 .venv
and enter the virtual environmentsource .venv/bin/activate
/.venv\Scripts\activate.bat
(on windows) - Install GramAddict with pip:
pip3 install gramaddict
- Optional! Create a file named
run.py
with the following content in it (or download it here (right-click on the link -> save as)):
import GramAddict
GramAddict.run()
- Clone project:
git clone https://github.com/GramAddict/bot.git gramaddict
- Go to GramAddict folder:
cd gramaddict
- (Optionally) Use virtualenv or similar to make a virtual environment
virtualenv -p python3 .venv
and enter the virtual environmentsource .venv/bin/activate
/.venv\Scripts\activate.bat
(on windows) - Install required libraries:
pip3 install -r requirements.txt
- Download and unzip Android platform tools, move them to a directory where you won't delete them accidentally, e.g.
Using Shell (expert mode)
mkdir -p ~/Library/Android/sdk
mv <path-to-downloads>/platform-tools/ ~/Library/Android/sdk
Using Mouse (noob mode)
Create a new folder somewhere, Unzip it inside that and remember this PATH! You will need it for the next step.
- Add platform-tools path to the PATH environment variable
Linux/macOS
1. Open ~/.bash_profile with any text editor you like.
2. Add the following line with the full path to the platform-tools directory: export PATH=~/Library/Android/sdk/platform-tools/:$PATH. This path may be different depending on the way you installed platform-tools.
3. Save file and restart Terminal.
Windows
1. Open Windows Explorer and right-click "My Computer" on left side.
2. In the pop-up menu, click Properties.
3. In the System Properties window, click the Advanced tab, and then click Environment Variables.
4. In the System Variables window, highlight Path, and click Edit.
5. In the Edit System Variables window, insert the cursor at the end of the Variable value field.
6. If the last character is not a semi-colon (;), add one.
7. After the final semi-colon, type the full path to the platform-tools directory: C:\Users\USERNAME\AppData\Local\Android\sdk\platform-tools. This path may be different depending on the way you installed platform-tools.
8. Click OK in each opened window and restart Command Prompt.
If you do it correctly, terminal / command prompt command adb devices
will print List of devices attached
Now that all the prep work is done, we can just about start the script.
If you have not already, you should make sure you have Developer options turned on, USB debugging enabled, as well as Install apps via USB (if available) on your phone.
If you want to use an emulator, and you're on Windows you can try with Memu.
After installing it and opening it, type that in console to open the connection: adb connect localhost:21503
If you're using more than oen Memu emulator, the port are +10 form the previous one -> 21513, 21523 and so on.
- Make sure that your Instagram is in English https://help.instagram.com/111923612310997
- Connect Android device to your computer with a USB cable
- Device will ask you to allow computer connection. Press "Connect"
- Type
adb devices
in terminal. It will display attached devices. There should be exactly one device unless you have multiple attached:
List of devices attached
A0B1CD2345678901 device
This is the ID of your device, you should copy/paste it in your config file with the device parameter e.g: device: A0B1CD2345678901 4. Initialize the uiautomator2 with this command: (It's also important when uiautomator2 gets updates)
python3 -m uiautomator2 init
- Proceed to set up your configuration (important).
- Finally, you can run the script from the location where run.py file is located or just by using
gramaddict run
shell script For doing that open the console and move to the gramaddict location and type the following:- Solution with run.py
python3 run.py --config accounts/yourusername/config.yml
- Solution with shell script (available only with pip installation)
gramaddict run --config accounts/yourusername/config.yml
ATTENTION: run.py must be inside that folder because at start it moves almost all folders near it inside accounts
!
For avoid problems, compare your situation with that before starting:
Tree of correct configuration for GIT (remember that you have to create the account folder paste the config-examples inside with your username):
gramaddict/
GramAddict/
core/
__init__.py
...
plugins/
__init__.py
...
__init__.py
version.py
config-examples/
...
res/
...
setup.py
...
accounts/
youraccountname/
config.yml
telegram.yml
filters.yml
whitelist.txt
blacklist.txt
comments_list.txt
pm_list.txt
run.py
Tree of correct configuration for PIP:
gramaddict/
accounts/
youraccountname/
config.yml
telegram.yml
filters.yml
whitelist.txt
blacklist.txt
comments_list.txt
pm_list.txt
-
if you run the bot but nothing happens in console (you are able to write again..), you are using a wrong Python alias (for example python3 run.py bla bla). Type
python -V
orpython3 -V
orpy -V
to find out the right one and then use it with the run.py -
if uiautomator2/minicab install gets stuck, try the following:
adb shell pkill atx-agent pip3 install uiautomator2 --upgrade python3 -m uiautomator2 init
Wait until it is finished and try to run the bot again.
-
Exception: -32001 Jsonrpc error: <java.lang.SecurityException> data: java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission
You forget to allow debugging activities in developing settings!
- Connect Android device to your computer with a USB cable
- (Optionally) If you installed the script with virtualenv, be sure to activate your environment before running:
source .venv/bin/activate
/.venv\Scripts\activate.bat
(on Windows) - Run the script:
python3 run.py --config accounts/yourusername/config.yml
Note: If you have a screen lock pin or swipe, you will need to unlock the script before each use. Otherwise - the script will do it for you each run. Additionally, the script also handles opening Instagram for you and choosing the correct account among the ones logged into the app. Disable notifications will allow the bot to run smootly without interferences.