Skip to content

Commit

Permalink
Merge pull request #11 from goodmind/ts-experimental
Browse files Browse the repository at this point in the history
Merge TypeScript version to development branch
  • Loading branch information
goodmind authored Aug 26, 2016
2 parents 47baf6d + 2af6a6e commit d54c3bc
Show file tree
Hide file tree
Showing 76 changed files with 1,607 additions and 1,723 deletions.
9 changes: 2 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,12 @@ cache:
notifications:
email: false
node_js:
- '4'
- 'node'
- 'iojs'
before_install:
- npm i -g npm@^2.0.0
- npm i -g npm@^3.0.0
before_script:
- npm prune
after_success:
- 'curl -Lo travis_after_all.py https://git.io/travis_after_all'
- python travis_after_all.py
- export $(cat .to_export_back) &> /dev/null
- npm run semantic-release
branches:
except:
- /^v\d+\.\d+\.\d+$/
32 changes: 22 additions & 10 deletions README.md
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
77 changes: 0 additions & 77 deletions index.d.ts

This file was deleted.

3 changes: 3 additions & 0 deletions lib/helpers/entities.d.ts
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;
31 changes: 14 additions & 17 deletions lib/helpers/entities.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/helpers/entities.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions lib/helpers/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './entities';
export declare let defaults: Function;
33 changes: 8 additions & 25 deletions lib/helpers/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/helpers/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './telegram-driver';
24 changes: 6 additions & 18 deletions lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions lib/interfaces.d.ts
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;
}
2 changes: 2 additions & 0 deletions lib/interfaces.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/interfaces.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions lib/plugins.d.ts
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;
Loading

0 comments on commit d54c3bc

Please sign in to comment.