Code Monkey home page Code Monkey logo

py-imessenger's Introduction

Py-iMessenger

Py-iMessenger is a chatbot that works with iMessage to execute commands using text messages. Home Page

Important

It appears that after upgrading to MacOS Monetery, Py-iMessenger has lost the ability to send files (images, videos, etc.) using Applescript. You can check out the problem here. With the newest commit, Py-iMessenger will check to see the MacOS version and will use GUI programming to actually open the Messages app, paste the file, and send it. This decreases performance signficantly and does not work all of the time.

Py-iMessenger is completely broken with MacOS Ventura. As far as I can tell, the database is no longer being updated with messages and frankly I've lost the energy to continue with this project. As of 06/05/23 I have tried accessing the iMessage DB as it shows that is updating but when trying to view the messages some appear as NULL until the entire database itself is copied and pasted elsewhere.

About

Py-iMessenger is a simple chatbot that is powered by Python and Applescript. By reading from the iMessage database on MacOS devices, Py-iMessenger allows developers to create extensions that can do various tasks such as sending files, pulling up the recent news, or adding to a todo list. These extensions can be accessed by users simply through texting.

Py-iMessenger's frontend design takes inspiration from Zeke Snider's Jared, however the backend was written by myself in Python.

Py-iMessenger also supports the ability to send text messages to a iMessage groupchat. When added to a groupchat, all users except the host device will be able to run commands that send texts, image sending is not availible.

Installation

The following steps show how to get Py-iMessenger up and running.

Be advised, Py-iMessenger is only compatible with MacOS devices which support iMessage, iMessage must be enabled to for the program to run. Running this program on a Windows or Linux device will result in an error message. Furthermore, the program has only been tested with Python3.9

  1. Begin by cloning or downloading the .zip file to your MacOS device
  2. Change directory into the cloned/downloaded folder
cd PATH/TO/FOLDER/Py-iMessenger
  1. Create a virtual environment within the folder
python3 -m venv venv
  1. Activate the virtual environment
source venv/bin/activate
  1. Install all the dependencies necessary for Py-iMessenger
pip3 install -r requirements.txt
  1. Run the program
python3 main.py
  • If you see an error that means that either the terminal or your IDE do not have "Full Disk Access", to remedy this click on the Apple logo on the top left of your screen, click "System Preferences", select "Security & Privacy", use the scroll bar on the left to find and click "Full Disk Access", select the lock icon at the bottom to allow changes and give full disk access to your terminal or IDE.

Disk Perms

  • The program you are using to run the program (terminal/IDE) may also ask you for permissions to control the Messages app, allow this.

Message Perms

Usage

Py-iMessenger supports sending both messages and files:

Messenger Demo

This demonstration is accurate for all MacOS versions prior to Monterey.

Technologies

  • AppleScript - Used to control iMessage
  • SQLite3 - Used to read the iMessage database
  • PyQt5 - Used to create frontened

Helpful Tips

When Py-iMessenger runs for the first time, all user data will be automatically loaded into src/backend/user/savedUser.json along with a couple other config files for things such as API keys and the settings UI, to stop these config files from showing up when doing "git status", it would be wise to run the following commands in the project directory:

> git update-index --skip-worktree src/backend/user/savedUser.json
> git update-index --skip-worktree src/backend/plugins/config.ini
> git update-index --skip-worktree src/frontend/settings/configUi.ini

Documentation

Documentation regarding how the program works, how to create an extension, and how to use the multitude of features that Py-iMessenger gives to develops, check out the YouTube playlist

Acknowledgments

A special thanks to Annelis Irigoyen for creating the logo.

License

Py-iMessenger uses the GNU Affero General Public License v3.0

More details regarding this license can be found here.

py-imessenger's People

Contributors

dependabot[bot] avatar varunpatelius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

py-imessenger's Issues

Documentation on creating new plugins

Hello! I've been tinkering with this repository for the past 2 days, and it's worked like a charm so far. However, I couldn't find any documentation on the creation of new plugins in your YouTube playlist. Some clarification in your README or an update to the video playlist would be much appreciated. Thanks!

Hosting

How you would recommend hosting this code? I do not want to leave my computer open all day and night for the program to run when at school or work. Any servers or techniques that you know of for this? Thanks Sir.

Issue when running main.py

So I just cloned this repo and installed requirements.txt. When running main.py I am getting the following:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/threading.py", line 973, in _bootstrap_inner
    self.run()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/neilmacgregor/Documents/Work/py-iMessenger/Py-iMessenger/src/backend/manage.py", line 172, in backendRunner
    self.deploymentMode()
  File "/Users/neilmacgregor/Documents/Work/py-iMessenger/Py-iMessenger/src/backend/manage.py", line 146, in deploymentMode
    message = self.database.findCommands()      #The database will return any message which seems like command
  File "/Users/neilmacgregor/Documents/Work/py-iMessenger/Py-iMessenger/src/backend/database/databaseModel.py", line 45, in findCommands
    self.cursor.execute(f"SELECT text, cache_roomnames, service, handle_id, ROWID FROM message WHERE text LIKE '/%' AND ROWID > {self.latestCommand}")
sqlite3.OperationalError: no such column: None

Any ideas?

requirements.txt does not install

ERROR: Command errored out with exit status 1:
command: /Users//Coding/Python/Py-iMessenger/venv/bin/python3 /Users//Coding/Python/Py-iMessenger/venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/j2/95vbnhpj6v74q8p3t1jrqzxm0000gn/T/tmprywjwsrl
cwd: /private/var/folders/j2/95vbnhpj6v74q8p3t1jrqzxm0000gn/T/pip-install-hg1hjrad/pyqt5_04e499e7727b4494b9ed90ff046cf404
Complete output (29 lines):
Traceback (most recent call last):
File "/Users//Coding/Python/Py-iMessenger/venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 143, in prepare_metadata_for_build_wheel
hook = backend.prepare_metadata_for_build_wheel
AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users//Coding/Python/Py-iMessenger/venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 349, in <module>
    main()
  File "/Users//Coding/Python/Py-iMessenger/venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 331, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/Users//Coding/Python/Py-iMessenger/venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 147, in prepare_metadata_for_build_wheel
    whl_basename = backend.build_wheel(metadata_directory, config_settings)
  File "/private/var/folders/j2/95vbnhpj6v74q8p3t1jrqzxm0000gn/T/pip-build-env-xl07mnsj/overlay/lib/python3.10/site-packages/sipbuild/api.py", line 51, in build_wheel
    project = AbstractProject.bootstrap('pep517')
  File "/private/var/folders/j2/95vbnhpj6v74q8p3t1jrqzxm0000gn/T/pip-build-env-xl07mnsj/overlay/lib/python3.10/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
    project.setup(pyproject, tool, tool_description)
  File "/private/var/folders/j2/95vbnhpj6v74q8p3t1jrqzxm0000gn/T/pip-build-env-xl07mnsj/overlay/lib/python3.10/site-packages/sipbuild/project.py", line 587, in setup
    self.apply_user_defaults(tool)
  File "/private/var/folders/j2/95vbnhpj6v74q8p3t1jrqzxm0000gn/T/pip-install-hg1hjrad/pyqt5_04e499e7727b4494b9ed90ff046cf404/project.py", line 63, in apply_user_defaults
    super().apply_user_defaults(tool)
  File "/private/var/folders/j2/95vbnhpj6v74q8p3t1jrqzxm0000gn/T/pip-build-env-xl07mnsj/overlay/lib/python3.10/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
    super().apply_user_defaults(tool)
  File "/private/var/folders/j2/95vbnhpj6v74q8p3t1jrqzxm0000gn/T/pip-build-env-xl07mnsj/overlay/lib/python3.10/site-packages/sipbuild/project.py", line 234, in apply_user_defaults
    self.builder.apply_user_defaults(tool)
  File "/private/var/folders/j2/95vbnhpj6v74q8p3t1jrqzxm0000gn/T/pip-build-env-xl07mnsj/overlay/lib/python3.10/site-packages/pyqtbuild/builder.py", line 67, in apply_user_defaults
    raise PyProjectOptionException('qmake',
sipbuild.pyproject.PyProjectOptionException
----------------------------------------

WARNING: Discarding https://files.pythonhosted.org/packages/8e/a4/d5e4bf99dd50134c88b95e926d7b81aad2473b47fde5e3e4eac2c69a8942/PyQt5-5.15.4.tar.gz#sha256=2a69597e0dd11caabe75fae133feca66387819fc9bc050f547e5551bce97e5be (from https://pypi.org/simple/pyqt5/) (requires-python:>=3.6). Command errored out with exit status 1: /Users//Coding/Python/Py-iMessenger/venv/bin/python3 /Users//Coding/Python/Py-iMessenger/venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/j2/95vbnhpj6v74q8p3t1jrqzxm0000gn/T/tmprywjwsrl Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement PyQt5==5.15.4 (from versions: 5.14.0, 5.14.1, 5.14.2, 5.15.0, 5.15.1, 5.15.2, 5.15.3, 5.15.4, 5.15.5, 5.15.6)
ERROR: No matching distribution found for PyQt5==5.15.4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.