-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
Merge TypeScript version to development branch
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,40 @@ | ||
# Cycle Telegram Driver | ||
|
||
[![Join the chat](https://img.shields.io/badge/chat-on_telegram-blue.svg)](https://telegram.me/cyclejs) [![Join the chat at https://gitter.im/goodmind/cycle-telegram](https://badges.gitter.im/goodmind/cycle-telegram.svg)](https://gitter.im/goodmind/cycle-telegram?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) | ||
<div align="center"> | ||
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/82/Telegram_logo.svg/240px-Telegram_logo.svg.png" width="200"> | ||
<br> | ||
<br> | ||
</div> | ||
|
||
A [Cycle.js](http://cycle.js.org) [Driver](http://cycle.js.org/drivers.html) for [Telegram](https://telegram.org/) | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/) | ||
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) | ||
[![npm version](https://img.shields.io/npm/v/cycle-telegram.svg?style=flat-square)](https://badge.fury.io/js/cycle-telegram) | ||
[![Dependency Status](https://img.shields.io/david/goodmind/cycle-telegram.svg?style=flat-square)](https://david-dm.org/goodmind/cycle-telegram) | ||
[![devDependency Status](https://img.shields.io/david/dev/goodmind/cycle-telegram.svg?style=flat-square)](https://david-dm.org/goodmind/cycle-telegram#info=devDependencies) | ||
|
||
![Telegram](https://upload.wikimedia.org/wikipedia/commons/thumb/8/82/Telegram_logo.svg/240px-Telegram_logo.svg.png) | ||
> A [Cycle.js](http://cycle.js.org) [Driver](http://cycle.js.org/drivers.html) for [Telegram](https://telegram.org/) | ||
## Install | ||
``` | ||
npm install cycle-telegram | ||
npm install cycle-telegram --save | ||
``` | ||
|
||
[![npm version](https://badge.fury.io/js/cycle-telegram.svg)](https://badge.fury.io/js/cycle-telegram) | ||
## Usage | ||
|
||
## Examples | ||
* [Long polling](https://github.com/goodmind/cycle-telegram/blob/master/example/index.js) | ||
* [Web hook](https://github.com/goodmind/cycle-telegram/blob/master/example/index-webhook.js) | ||
|
||
## Built with Cycle Telegram | ||
## Examples | ||
|
||
* [@cyclejs_bot](https://telegram.me/cyclejs_bot) — [source](https://github.com/goodmind/cycle-telegram-bot) | ||
* [@tryhaskell_bot](https://telegram.me/tryhaskell_bot) - [source](https://github.com/goodmind/tryhaskell-bot) | ||
|
||
## Contribute | ||
|
||
PRs accepted | ||
|
||
Note: If you had questions ask them [in my telegram](https://telegram.me/goodmind) | ||
|
||
- - - | ||
## License | ||
|
||
[![Dependency Status](https://david-dm.org/goodmind/cycle-telegram.svg)](https://david-dm.org/goodmind/cycle-telegram) | ||
[![devDependency Status](https://david-dm.org/goodmind/cycle-telegram/dev-status.svg)](https://david-dm.org/goodmind/cycle-telegram#info=devDependencies) | ||
MIT (c) Goodmind |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export declare let entityIs: Function; | ||
export declare let getEntityFirst: Function; | ||
export declare let getEntityFirstValue: Function; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './entities'; | ||
export declare let defaults: Function; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './telegram-driver'; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Observable, IDisposable } from 'rx'; | ||
import { TcombWebhookResponse, TcombRequest } from './runtime-types/types'; | ||
export declare type Token = string; | ||
export interface Update { | ||
update_id: number; | ||
message?: any; | ||
inline_query?: any; | ||
chosen_inline_result?: any; | ||
callback_query?: any; | ||
} | ||
export interface TelegramDriverState { | ||
startDate: number; | ||
offset: number; | ||
updates: Update[]; | ||
} | ||
export interface TelegramDriverOptions { | ||
webhook?: boolean; | ||
startDate?: number; | ||
} | ||
export declare type EventsFn = (eventName: string) => Observable<Update>; | ||
export interface TelegramDriverExecution extends IDisposable { | ||
token: Token; | ||
updates: Observable<TelegramDriverState>; | ||
responses: Observable<TelegramAPIResponseResult>; | ||
events: EventsFn; | ||
} | ||
export declare type TelegramDriverSink = TcombRequest | TcombWebhookResponse; | ||
export interface TelegramDriverSources { | ||
message: Observable<Update>; | ||
inlineQuery: Observable<Update>; | ||
chosenInlineResult: Observable<Update>; | ||
callbackQuery: Observable<Update>; | ||
} | ||
export interface TelegramAPIRequest { | ||
token: Token; | ||
method: string; | ||
query: any; | ||
httpMethod?: string; | ||
} | ||
export interface TelegramAPIResponseResult { | ||
} | ||
export interface TelegramAPIError { | ||
ok: boolean; | ||
description: string; | ||
error_code: number; | ||
} | ||
export interface TelegramAPIResponse { | ||
ok: boolean; | ||
description?: string; | ||
result: TelegramAPIResponseResult; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Update } from './interfaces'; | ||
import { Observable } from 'rx'; | ||
import * as t from 'tcomb'; | ||
export interface ComponentSources { | ||
[driverName: string]: Observable<any> | any; | ||
} | ||
export declare type ComponentSinks = { | ||
[driverName: string]: Observable<any>; | ||
} | void; | ||
export declare type Component = (sources: ComponentSources, update: Update) => ComponentSinks; | ||
export interface Plugin { | ||
type: t.Type<any>; | ||
name: string; | ||
pattern?: RegExp; | ||
component: Component; | ||
} | ||
export declare function matchWith(this: Observable<Update>, plugins: Plugin[], sources: ComponentSources, {dupe}?: { | ||
dupe?: boolean; | ||
}): Observable<ComponentSinks>; | ||
export declare function matchStream(observable: Observable<Update>, ...args: any[]): any; |