Skip to content

Commit

Permalink
fix bug with interval
Browse files Browse the repository at this point in the history
  • Loading branch information
JiPaix committed Aug 21, 2020
1 parent e87a576 commit 4d66e32
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
6 changes: 2 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
docs/** linguist-documentation=true
examples/** linguist-documentation=true
intellisense.js linguist-vendored=true
build/index.js linguist-vendored=true
lib/** linguist-vendored=true
bin/xdccjs.ts linguist-language=typescript
build/** linguist-vendored=true
**/lib/** linguist-vendored=true
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xdccjs",
"version": "4.0.2",
"version": "4.0.3",
"description": "download files from XDCC bots on IRC, complete implementation of the XDCC protocol",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
11 changes: 7 additions & 4 deletions src/bin/xdccjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ export class XdccJSbin extends Profiles {
const start = time
const inter = setInterval(() => {
if (start > 0) {
this.writeMSG(time--)
this.writeMSG(--time)
}
if (time === -1) {
if (time === 0) {
if (start > 0) {
this.clearMSG()
}
clearInterval(inter)
xdccJS.download(bot, download)
clearInterval(inter)
}
}, 1000)
}
Expand All @@ -91,7 +91,10 @@ export class XdccJSbin extends Profiles {
throw new BinError('%danger% You must specify a packet number to download, eg. %grey%--download 1, 3, 55-60')
}
const download = this.program.download.join('')
const bot: string = this.program.bot ? this.program.bot : opts[1].bot
const bot = this.program.bot ? this.program.bot : opts[1].bot
if (!bot) {
throw new Error('Control flow error: downloadwith()')
}
const wait = opts[1].wait
const xdccJS = new XDCC(opts[0])
xdccJS.on('ready', () => {
Expand Down

0 comments on commit 4d66e32

Please sign in to comment.