Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Initial public release.
Browse files Browse the repository at this point in the history
  • Loading branch information
HouCoder committed Jun 11, 2020
1 parent 5886c5d commit 972c4af
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 40 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![GitHub Actions][github-image]][github-url]
[![TypeScript Style Guide][gts-image]][gts-url]

The newly rewritten project has a few advantages over the old:
The newly rewritten project has a few advantages over [the old one](https://github.com/HouCoder/tele-aria2/tree/legacy-python):

1. Fully touch based, more easy to use, no command required to use this bot.
2. Real time notification, it's now using Aria2's Websocket protocol to communicate.
Expand All @@ -16,19 +16,20 @@ The newly rewritten project has a few advantages over the old:

1. Create your own bot and get its access token by using [@BotFather](https://telegram.me/botfather).
1. Get your unique user ID - https://stackoverflow.com/a/32777943/4480674.
1. (Optional) For mainland China users, be sure to have a socks proxy server running.
1. (Optional) For mainland China users, be sure to have a **HTTP** proxy up and running.
1. `$ npm install tele-aria2 -g`.
1. `$ tele-aria2 --help` to see how to get started.

## Configuration example
## Configuration file example

```json
{
"aria2Server": "ws://192.168.1.154:6800/jsonrpc",
"aria2Key": "xxx",
"proxy": "socks://127.0.0.1:7891",
"proxy": "http://127.0.0.1:7890",
"tgBot": "123456789:xxx",
"tgUser": 123456
"tgUser": 123456,
"maxIndex": 10
}
```

Expand Down Expand Up @@ -56,6 +57,7 @@ No worries, just send your torrent file to chat!

- [ ] Docker image
- [ ] Unit testing
- [ ] Auto release to npm

[npm-image]: https://img.shields.io/npm/v/tele-aria2.svg
[npm-url]: https://npmjs.org/package/tele-aria2
Expand Down
38 changes: 9 additions & 29 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tele-aria2",
"version": "0.1.0-beta.2",
"version": "0.1.0",
"description": "Control your Aria2 server through Telegram",
"homepage": "https://github.com/HouCoder/tele-aria2#tele-aria2",
"main": "./dist/run.js",
Expand Down Expand Up @@ -39,8 +39,8 @@
"@types/websocket": "^1.0.0",
"@types/ws": "^7.2.5",
"commander": "^5.1.0",
"https-proxy-agent": "^5.0.0",
"needle": "^2.5.0",
"socks-proxy-agent": "^5.0.0",
"telegraf": "^3.38.0",
"typescript": "^3.9.5",
"uuid": "^8.1.0",
Expand Down
6 changes: 3 additions & 3 deletions src/Telegram.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SocksProxyAgent } from 'socks-proxy-agent';
import { HttpsProxyAgent } from 'https-proxy-agent';
import Telegraf, { Markup, Context } from 'telegraf';
import needle, { NeedleResponse } from 'needle';
import winston from 'winston';
Expand All @@ -19,7 +19,7 @@ export default class Telegram {

private maxIndex: number;

private agent: SocksProxyAgent | undefined;
private agent: HttpsProxyAgent | undefined;

constructor(options: {
tgBot: string;
Expand All @@ -35,7 +35,7 @@ export default class Telegram {
this.logger = options.logger;

if (options.proxy) {
this.agent = new SocksProxyAgent(options.proxy);
this.agent = new HttpsProxyAgent(options.proxy);
}

this.bot = this.connect2Tg({
Expand Down
2 changes: 1 addition & 1 deletion src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ program
.option('-b, --tg-bot <telegram bot key>', 'Telegram bot key')
// eslint-disable-next-line max-len
.option('-u, --tg-user <telegram user id>', 'Telegram user ID, see here to get your ID - https://stackoverflow.com/a/32777943/4480674')
.option('-p, --proxy <proxy>', 'Access Telegram server through a proxy')
.option('-p, --proxy <proxy>', 'Access Telegram server through a HTTP proxy')
.option('-m, --max-index <maximum index>', 'Max items in the range of [1, max-index], default 20')
.option('-c, --config <config file path>', 'Load options from a JSON config file')
.option('-V, --version', 'Output the current version')
Expand Down

0 comments on commit 972c4af

Please sign in to comment.