neuopk.blogg.se

Telegram os x
Telegram os x




In a Terminal window to set the system volume to n. This article (links to ) gives a nice round-up of what we can do. Turns out, there’s a ton of stuff we can accomplish with AppleScript. We will use osascript to execute AppleScript. Instead of trying to manipulate the system natively through PyObjC, we will be calling several command line utilities with Python’s subprocess. PyObjC will be the first answer people usually jump to, but there’s an easier way: command line utilities. How do we do all of that programatically, and with Python? Let’s take a step back and think about how we can programatically adjust the system volume, display brightness, and turn the display off. Make a note of your Telegram UID, we’ll be using this to ensure the bot only responds to our commands. Great! Now our bot is alive and responding. It should greet you with your Telegram first name and UID. Run python bot.py and hit your bot up on Telegram with “/hello”. Note: If you’re unsure how python-telegram-bot works, check out the “ Getting started” section of their Github repo.

telegram os x

Let’s check and see if our bot is working by having it respond to the “/hello” command with our Telegram first name and user ID: Open bot.py in your editor of choice, and we’re ready to get started. venv/bin/activate $ pip install python-telegram-bot $ touch bot.py Next, create a new Python project and install python-telegram-bot: $ mkdir tg-mac-remote & cd tg-mac-remote $ virtualenv. Tip: If you don’t want your bot to be discovered, choose a random username or prepend some random characters to it. We’ll use this token to interact with Telegram’s API.

telegram os x

We’ll need to create a Telegram bot by speaking to Follow the on-screen instructions: name your bot and choose a username for it, and at the end of the steps, you will be given an API access token. If you run into any troubles with the steps below, look to the repository as a reference. I decided on the latter because it’s easier to secure than a web app, and I decided on Telegram because it’s widely available and probably the most straightforward. My requirements were simple, but if I wanted this to be truly remote and accessible anywhere, my only options are the Web or a bot I can send commands to. After exploring several options, I found none of them to be viable for me, and thus, I set out to develop my own solution. I needed a quick way to remotely perform system operations: adjusting & muting the system volume, screen brightness, and putting the display to sleep.






Telegram os x