This is a sample Telegram Bot to showcase Webtask.
- Main function promisification through
Bluebird.tryandasCallback. - Query params and body access.
- Secrets (TG_TOKEN)
- Get the Webtask runner URL
- Basic Telegram Bot API usage
This example demostrate the usage of WebTask Storage with multiple models and how to save / filter / find them.
$ curl https://__host__.run.webtask.io/example\?action\=delete_all
{}
$ curl https://__host__.run.webtask.io/example\?action\=save_model \
-H "Content-Type: application/json" \
--data '{"modelName": "planets", "properties": {"name": "Earth"}}'
{}| const ts = require('tail-stream') | |
| const http = require('http') | |
| const PORT = 1234 | |
| const HOST = '0.0.0.0' | |
| const FILE = 'info.log' | |
| const server = http.createServer((req, resp) => { | |
| const tstream = ts.createReadStream(FILE, { | |
| beginAt: 0, |
| #! /bin/bash | |
| cd $(mktemp -d) | |
| wget https://aur.archlinux.org/cgit/aur.git/snapshot/insomnia.tar.gz | |
| tar xzf insomnia.tar.gz | |
| cd insomnia | |
| makepkg -s | |
| sudo pacman -U insomnia-*-x86_64.pkg.tar |
| [Unit] | |
| Description=Node.js App | |
| After=network.target | |
| [Service] | |
| Type=simple | |
| ExecStart=/usr/local/node-v7.4.0/bin/node index.js | |
| WorkingDirectory=/home/yago/produccion/app | |
| Environment="HOST=127.0.0.1" | |
| Environment="PORT=1234" |
| const emojisStr = '๐๐๐ ๐๐๐๐๐๐๐ค๐ถ๐๐ค๐๐ก๐๐๐โน๏ธ๐๐ฎ๐ด๐ค๐ฉ๐ญ๐๐ฟ๐๐ธ๐ ๐ ๐๐๐ช๐ป๐ค๐บ๐๐ ๐ท๐๐ผ๐บ๐ฏ๐ ๐ฆ๐๐๐พ๐๐๐พ๐๐๐๐๐ฆ๐ฅ๐ฅโ๏ธโจโ๏ธ๐ง๐๐๐๐ฝ๐๐ฎโ๏ธ๐งโฝ๏ธ๐๐๐น๐ฐ๐ฃ๐๐ต๐ฎ๐ฌ๐๐๐จ๐๐ ๐ฅ๐๐ข๐ ๐ง๐ง๐งโ๏ธ๐ฅ๐ฑโจ๐ป๐ ๐๐ฆ๐ด๐ธ๐ฎ๐๐ฌ๐ญ๐ซ๐๐๐โ๏ธ๐๐๐๐โค๏ธ๐๐๐๐๐๐๐พโ ๏ธโป๏ธ๐ต๐ฌ๐๐ฌ๐ง๐บ๐ธ๐ช๐ธ๐ต๐น๐ณ๐บ๐ณ๐ท๐ฌ๐พ๐ฌ๐ฆ๐ฎ๐ธ๐ฏ๐ต'; | |
| const emojis = [...emojisStr] | |
| .filter(emoji => emoji.length > 0) | |
| .filter(emoji => emoji !== '\uFE0F'); | |
| module.exports = emojis; |
| BotToken = "123456:AAAAAAA" | |
| AdminId = 11696011 | |
| TorrentDownloadPath = "/tmp" |
| server { | |
| listen 80; | |
| root /home/yago/production/lounge/client/; | |
| server_name irc.yago.me; | |
| autoindex off; | |
| try_files $uri $uri @remote; |
| mkdir -p /mnt/downloads | |
| chmod 777 /mnt/downloads/ | |
| sudo cp /usr/share/systemd/tmp.mount /etc/systemd/system/tmp.mount | |
| sudo systemctl enable tmp.mount | |
| sudo systemctl start tmp.mount | |
| mkfs -t ext4 /dev/vdb | |
| cp mnt-downloads.mount /etc/systemd/system/ | |
| systemctl enable mnt-downloads.mount |
| cd /tmp | |
| youtube-dl "https://www.youtube.com/watch?v=bS5P_LAqiVg" | |
| # 6s of durantion. Starting from 00:10:46. Kung Fury as input file. 11 fps. 640x360 frame size. Yes to all. Save as out.gif | |
| ffmpeg -t 6 -ss 00:10:46 -i KUNG\ FURY\ Official\ Movie\ \[HD\]-bS5P_LAqiVg.mkv -r 11 -s 640x360 -y out.gif | |
| # The maximum GIF file size for twitter is 5MB, our file is 4.8MB |