Generate an url to a telegram bot command - url

I want to create a QR code than links to a telegram bot so when people scans this code they can automatically issues certain command
Is that possible?

Using Deep Linking you can start a Telegram bot passing an extra parameter
https://t.me/my_telegram_bot?start=my_action
The link will open the chatbot on Telegram showing the START button: the parameter my_action is passed to the start command.
As far as I know you cannot pass commands dynamically but you can use the /start command as entry point (the parameter will define what to do).

Related

TextRotation angle is never set in Google Sheet API

I'm using Google Sheets API v4 from Java Client. I'm trying to get format from Cell class. Everything goes fine.
TEXT ROTATION
I'm succeed in getting TextRotation element with Vertical property set but, angle property is never set, what ever I put on source Google Sheets document.
Whatever the angle value selected in Google Sheet App, angle property is never set.
I've tried to inspect returned JSON, to know if the issue is in Java Client.
But JSON REST API also never returns this property.
Current Result:
.
Expected Result:
Issue and workaround:
When I saw CellFormat of the official document, I thought that the value of textRotation can be retrieved by the fields of sheets(data(rowData(values(userEnteredFormat(textRotation))))) when the method of "spreadsheets.get" is used. But when I tested this, no values are returned. So I thought that this might be a bug. And, when I searched this at the Google issue tracker, I found https://issuetracker.google.com/issues/146274218. From this situation, in the current stage, it seems that the values of textRotation cannot be retrieved by the method of "spreadsheets.get" of Sheets API.
When you want to retrieve the value of textRotation using a script, as a current workaround, you can achieve it using the Web Apps created by Google Apps Script as a wrapper. In this answer, I would like to propose the workaround.
When this workaround is reflected to the flow for your situation, it becomes as follows.
Usage:
1. Create new project of Google Apps Script.
Sample script of Web Apps is a Google Apps Script. So please create a project of Google Apps Script.
If you want to directly create it, please access to https://script.new/. In this case, if you are not logged in Google, the log in screen is opened. So please log in to Google. By this, the script editor of Google Apps Script is opened.
2. Prepare Web Apps side. (server side)
Please copy and paste the following script (Google Apps Script) to the script editor. This script is for the Web Apps. This Web Apps is used as an API.
Server side: Google Apps Script
function doGet(e) {
const key = "sampleKey";
const id = e.parameter.spreadsheetId;
const sheetName = e.parameter.sheetName;
if (e.parameter.key != key || !id || !sheetName) {
return ContentService.createTextOutput(JSON.stringify({message: "Error."})).setMimeType(ContentService.MimeType.JSON);
}
const sheet = SpreadsheetApp.openById(id).getSheetByName(sheetName);
const textRotations = sheet.getDataRange().getTextRotations().map(r => r.map(c => ({angle: c.getDegrees(), vertical: c.isVertical()})));
return ContentService.createTextOutput(JSON.stringify(textRotations)).setMimeType(ContentService.MimeType.JSON);
}
3. Deploy Web Apps.
On the script editor, Open a dialog box by "Publish" -> "Deploy as web app".
Select "Me" for "Execute the app as:".
By this, the script is run as the owner.
Select "Anyone, even anonymous" for "Who has access to the app:".
Of course, you can use the access token for this situation. But in this case, as a simple setting, I use the access key instead of the access token.
Click "Deploy" button as new "Project version".
Automatically open a dialog box of "Authorization required".
Click "Review Permissions".
Select own account.
Click "Advanced" at "This app isn't verified".
Click "Go to ### project name ###(unsafe)"
Click "Allow" button.
Click "OK".
Copy the URL of Web Apps. It's like https://script.google.com/macros/s/###/exec.
When you modified the Google Apps Script, please redeploy as new version. By this, the modified script is reflected to Web Apps. Please be careful this.
3. Testing.
As a simple test, when it requests to the Web Apps using a curl command, it becomes as follows. Please set the spreadsheet ID and sheet name. When the Web Apps is correctly deployed, the values are returned.
$ curl -L "https://script.google.com/macros/s/###/exec?spreadsheetId=###&sheetName=Sheet1&key=sampleKey"
Result:
The data range is used for retrieving the values. So for example, when the values are set to the cells "A1:C3" in "Sheet1", the following result is returned.
[
[{"angle":30,"vertical":false},{"angle":0,"vertical":true},{"angle":0,"vertical":false}],
[{"angle":30,"vertical":false},{"angle":30,"vertical":false},{"angle":0,"vertical":false}]
]
In this case, the cells "A1, A2, B2" have the text rotation with 30 degree. And, the cell "B1" has the vertical direction.
Note:
When you modified the script of Web Apps, please redeploy the Web Apps as new version. By this, the latest script is reflected to Web Apps. Please be careful this.
References:
CellFormat
getTextRotations()
Web Apps
Taking advantage of Web Apps with Google Apps Script
Finally, I've written a JS Library : screen-rotation.js to manage all this stuff.
screenorientation().change(function(){
// My event management
});
It supports iOS, Android & desktop browsers

Google Home API.IA for private use on own Home

I have created a Google Home agent to control my thermostat. Of course I want to be the only one using and controling it. So I dont want to publish the app.
There is a small tutorial for extending the use of the simulator and even an update for V2. But the V2 update I can't seem te get to work, I get to following error:
Unable to parse action package: invalid character ',' after top-level
value
Did someone else get this to work?
This is the tutorial (scroll down for the update by #dadykhoff)
Make google actions development project preview persist longer

How to integrate CANOE with Jenkins?

I want to integrate CANOE with Jenkins. Can anybody please tell me how to do that. For now I am able to open CANOE window through Jenkins. But it shows a disclaimer on startup. I want to click on "I accept" button automatically through Jenkins using any command. Can you please tell me how to do that or what is that command?. Is there any other way to click on that button without pressing the key?
CANoe is implemented as a COM-server. Using the COM-interface, you can start CANoe from a script and thus bypass the disclaimer. I have managed to do this either using C# or python with pywin32. The CANoe help-section contains some help on what COM-server commands are available to get you started.
edit:
If CANoe is associated with cfg-files as standard application, you can call the cfg-file directly and have it launch CANoe. That will still require you to manually click the disclaimer dialog though. In a script, such as the one I mentioned earlier, you can create it in such a way that you are able to specify which cfg-file to use as an input parameter. It can also be written so that you can specify certain test-suites containing your CAPL-scripts. It can basically give you access to most CANoe features necessary to run test-suites with different settings. However, I've not tried a lot of them yet.
Unfortunately, none of your examples can be achieved without creating this kind of script.
CANOE simply loads a .cfg configuration file. For jenkins, I am using the Visual Basics script and same triggering into the Jenkins job.
In this was it bypasses the "I accept" and other windows and loads the desired configuration also also using same kind of VB scirpt you can close the application.
'ToStart CANoe_Start.vbs
Set App = CreateObject("CANoe.Application")
dim fso: set fso = CreateObject("Scripting.FileSystemObject")
dim CANoe_config
CANoe_config = fso.BuildPath(fso.GetAbsolutePathName("."), "<target.cfg>")
App.Measurement.Start()
After that you can add the operations in jenkins jobs; to close the same appilcation use :
'ToStop CANoe_Stop.vbs
Set App = CreateObject("CANoe.Application")
App.Quit()
This worked for me. You can call the vbs's over jenkins jobs.

How to backup Telegram chat?

I found somethings like this code to send to Telegram-CLI but I have no idea what it means or how to do it so if someone could explain it to me step by step I'd be so happy.
https://github.com/psamim/telegram-cli-backup
I couldn't install sqlite3 for some reason with the given code there.
I'm using windows, do I need to boot into Ubuntu to do it?
Anyways, explain it to me like I'm 3 years old in case I won't know something.
Thanks so much.
If you are using windows check the instructions here. I've only tried in Linux and the link in your question (using Lua) works.
The following scripts too does the job well
Python script to backup everything
https://github.com/tvdstaaij/telegram-json-backup
Here is a ruby version of the same https://github.com/tvdstaaij/telegram-history-dump
The mentioned script is updated and now it saves the conversations into a CSV file and does not need sqlite3 library any more. It only needs lua.
It seems I could help you a little.
I am using Ubuntu and I wrote this Bash-script:
#!/bin/bash
TOKEN='YourBot:Token'
URL='https://api.telegram.org/bot'$TOKEN
UPD_URL=$URL'/getUpdates?offset='
function get_offset {
res=$(curl $UPD_URL$OFFSET)
OFFSET=$(echo $res | grep "update_id" | cut -f 4 -d ':' | cut -f 1 -d ',' | head -1)
OFFSET=$((OFFSET+1))
}
while :
do
get_offset
if echo $res | grep "message"
then echo $res >> BackupChat.txt
fi
done
It is very simple bash-script.
Obviously you must create your own bot and add bot to the chat you want to backup.
Bad things about this script is that it creates pretty difficult for reading text logfile with mass garbage like "username" "date" "::" , etc. But it could be improved for making a normal output looking like a cool database.
I hope you have enough Linux skills to make it by yourself.
I think the situation improved since this question was asked, so here an answer from a 2020's point of view that does not require any programming skills or command line tools.
To backup (aka. "export") your Telegram chats download the desktop client available here:
https://desktop.telegram.org/
On Linux, for example, unpack the downloaded file into any subdirectory like ~/tmp/, and start the client from there, like
$ cd ~/tmp/Telegram
$ ./Telegram
You will need to register first with your phone number like on any other Telegram devices via a confirmation code sent to your already logged-in telegram account.
The user interface looks similar to the web interface.
Go into a chat you are interested in, then in the upper right menu choose "Export chat history". Click all checkboxes you are interested in, like media files, GIFs, stickers, etc. and click export.
By default it generates a complete HTML files and subdirectory structure under ~/Downloads/Telegram Desktop/ which you can open for instance like this:
firefox ~/Downloads/Telegram\ Desktop/ChatExport_01_02_2020/messages.html
If you need a more complete backup of all chats you can go to the central menu (3 small bars) on the top left, then "Settings" -> "Advanced" -> under "Data and Storage" choose "Export Telegram data". There you can also click checkboxes for what you are interested in. Near the bottom is aselection between HTML for humas, or machine-readable JSON.
On the very first export request it first requires you to confirm on another Telegram instance to allow the export request, to avoid misuse. Once you confirmed, e.g. from your mobile phone, you can go to export again and proceed as described above without any further confirmations.

Building Passbook Passes

I've been working on integration of Passbook for some of my apps. Right now, I've used Ray Wenderlich's tutorial on this, and it is quite frankly a pain to build even one Pass. I have to get the icon files all in place, program the JSON file, get the manifest file filled in with all the SHA1 values, and run a few lines in terminal to sign it, and then another line to zip it. Are there any online services or programs that can be used to save a pkpass file to computer, that I can then upload to my server?
There are also quite some developer tools that help you to create passes, you can find a list on wikipedia.
We provide an Objective-C SDK and a free cloud service that lets you create templates and generate passes. You can find the SDK on github (Sample App is included).
There are a number of services that can be used to generate passess. Take a look on wikipedia for a comprehensive list of providers, tools and projects.
If you want to update passes, then you will need to build a Passbook Web Service. When a pass is updated, the web service sends a new .pkpass bundle to the device. Therefore, your web service must also be capable of signing passes unless you want to manually create and upload them to your server before sending out a push request.
Using our service, PassKit, you can create a template using WSIYWIG editor then create a pass directly on your server via a simple API call. You can also update passes and push updates to passes via our API. If you just want to get hold of the .pkpass bundle, then you can append /d to the pass URL (the one beginning with r.pass.is), or use PassKit API in your User Agent string.
you should also check out Apple's Passbook Support Materials here:
https://developer.apple.com/passbook/
They have a simple XCode project called SignPass that you can use to easily create your own Passes.
Note: you need to be a member of Apple's Developer program to access these materials ..
There's lots more Passbook related info here:
http://www.flonsolutions.com
Andrew

Resources