-
Как вызвать бота? В
Telegram
ник@oshlibot
-
Как запустить своего бота? Скопировать код. Получить [
apikey
][BotFather link]. Добавитьapikey
в свойства скрипта. Опубликовать скрипт как веб-приложение для всех. Запустить вручнуюsetWebhook()
из модуляScriptService.gs
-
Важно. В настройках необходимо в свойства скрипта добавить
apikey
-
Как получить
apikey
? Необходимо спросить у [@BotFather][BotFather link] -
Какие бывают способы доступа для бота? Два метода API определяют будущее поведение приложения: [getUpdates][getUpdates link] или [setWebhook][setWebhook link]
-
@oshlibot
использует подписку на [Webhooks][setWebhook link]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void function() { "use strict" | |
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WIP DO NOT USE WIP !!!!!!!!!!!!!!!!!!!!! | |
DO NOT USE THIS YET. | |
USE THE 2016 VERSION BELOW PLEASE. | |
WWWWWWWW WWWWWWWWIIIIIIIIIIPPPPPPPPPPPPPPPPP | |
W::::::W W::::::WI::::::::IP::::::::::::::::P | |
W::::::W W::::::WI::::::::IP::::::PPPPPP:::::P |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onOpen() { | |
SpreadsheetApp.getUi().createMenu('Testing') | |
.addItem('Show Sidebar', 'showSidebar') | |
.addToUi(); | |
} | |
function showSidebar() { | |
var sidebar = HtmlService.createHtmlOutputFromFile('Sidebar') | |
.setSandboxMode(HtmlService.SandboxMode.IFRAME) | |
.setTitle('Sidebar'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ChunkyCache(cache, chunkSize){ | |
return { | |
put: function (key, value, timeout) { | |
var json = JSON.stringify(value); | |
var cSize = Math.floor(chunkSize / 2); | |
var chunks = []; | |
var index = 0; | |
while (index < json.length){ | |
cKey = key + "_" + index; | |
chunks.push(cKey); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function logClass(target: any) { | |
// save a reference to the original constructor | |
var original = target; | |
// a utility function to generate instances of a class | |
function construct(constructor, args) { | |
var c : any = function () { | |
return constructor.apply(this, args); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var CLIENT_ID = 'YOUR_CLIENT_ID'; | |
var CLIENT_SECRET = 'YOUR_CLIENT_SECRET'; | |
function getService() { | |
// Create a new service with the given name. The name will be used when | |
// persisting the authorized token, so ensure it is unique within the | |
// scope of the property store. | |
return OAuth2.createService('blogger') | |
// Set the endpoint URLs, which are the same for all Google services. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a quick demonstration of "function inheritance" as described in | |
// this paper from Daniel Brown and William Cook. | |
// http://www.cs.utexas.edu/users/wcook/Drafts/2009/sblp09-memo-mixins.pdf | |
// Expressed in TypeScript (and without the monads). | |
// Syntax note: When you write function types in TypeScript, you need to name | |
// each parameter. But the names don't actually matter, so I just use _. You | |
// can read `(_:A) => B` as `a -> b` in ML or Haskell syntax. | |
// In Brown and Cook's Haskell, `type Gen a = a -> a` is a "generator." The |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ABOUT | |
* Google Apps Script to post a message to Slack when someone responds to a Google Form. | |
* | |
* Uses Slack incoming webhooks - https://api.slack.com/incoming-webhooks | |
* and FormsResponse - https://developers.google.com/apps-script/reference/forms/form-response | |
* | |
* | |
* AUTHOR | |
* Akash A <github.com/akash1810> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns Mobile Speed & Optimization and Desktop Speed & Optimization values in six adjacent columns | |
* by Cagri Sarigoz | |
*/ | |
function checkAll(Url) { | |
//CHANGE YOUR API KEY WITH YOUR_API_KEY BELOW | |
var key = "YOUR_API_KEY"; | |
var serviceUrlMobile = "https://www.googleapis.com/pagespeedonline/v4/runPagespeed?url=" + Url + "&strategy=mobile&key=" + key; | |
var serviceUrlDesktop = "https://www.googleapis.com/pagespeedonline/v4/runPagespeed?url=" + Url + "&strategy=desktop&key=" + key; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @license | |
* lodash 3.9.3 (Custom Build) <https://lodash.com/> | |
* Build: `lodash modern -o ./lodash.js` | |
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | |
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | |
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | |
* Available under MIT license <https://lodash.com/license> | |
*/ | |
;(function() { |