teralove / translate-chat

Translates incoming chat text into another language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Censorship bug.

opened this issue · comments

The following error happens when someone trying to whisper you an foreign or mistakenly written words.

Unhandled rejection ReferenceError: message is not defined
    at C:\X\Proxy\bin\node_modules\Translate-chat\index.js:33:86
    at C:\X\Proxy\bin\node_modules\Translate-chat\index.js:57:38
    at C:\X\Proxy\bin\node_modules\Translate-chat\node_modules\node-google-translate-skidz\lib\translate.js:81:5
    at tryCatcher (C:\X\Proxy\bin\node_modules\Translate-chat\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\X\Proxy\bin\node_modules\Translate-chat\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (C:\X\Proxy\bin\node_modules\Translate-chat\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromise0 (C:\X\Proxy\bin\node_modules\Translate-chat\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (C:\X\Proxy\bin\node_modules\Translate-chat\node_modules\bluebird\js\release\promise.js:689:18)
    at Async._drainQueue (C:\X\Proxy\bin\node_modules\Translate-chat\node_modules\bluebird\js\release\async.js:133:16)
    at Async._drainQueues (C:\X\Proxy\bin\node_modules\Translate-chat\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (C:\X\Proxy\bin\node_modules\Translate-chat\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:696:18)
    at tryOnImmediate (timers.js:667:5)
    at processImmediate (timers.js:649:5)

And This for Private chat.

Unhandled rejection ReferenceError: message is not defined
    at C:\X\Proxy\bin\node_modules\Translate-chat\index.js:44:91
    at C:\X\Proxy\bin\node_modules\Translate-chat\index.js:57:38
    at C:\X\Proxy\bin\node_modules\Translate-chat\node_modules\node-google-translate-skidz\lib\translate.js:81:5
    at tryCatcher (C:\X\Proxy\bin\node_modules\Translate-chat\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\X\Proxy\bin\node_modules\Translate-chat\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (C:\X\Proxy\bin\node_modules\Translate-chat\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromise0 (C:\X\Proxy\bin\node_modules\Translate-chat\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (C:\X\Proxy\bin\node_modules\Translate-chat\node_modules\bluebird\js\release\promise.js:689:18)
    at Async._drainQueue (C:\X\Proxy\bin\node_modules\Translate-chat\node_modules\bluebird\js\release\async.js:133:16)
    at Async._drainQueues (C:\X\Proxy\bin\node_modules\Translate-chat\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (C:\X\Proxy\bin\node_modules\Translate-chat\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:696:18)
    at tryOnImmediate (timers.js:667:5)
    at processImmediate (timers.js:649:5)

Solution for first 2 would be just replacing 'message: message' of This for whisper & This for Private with 'message: query.translation' May be mistakenly written (too much copy-paste) 👍 :)

the last issue is, when someone says censored words incorrectly, or in foreign language, translated result will be censored. E.g. 'cunt' = 'kut' in Dutch This:

23:38     [Received Whisper][?] : kut
23:38     [Received Whisper][? (translated)] : ~(@~

No solution with my noob js knowledge, I tried many things.

Good catch. I was using S_CHAT to test with and forgot to update the other two hooks. 'message' was an object I was using earlier, known as 'query' now.

Don't know what to do about the censorship bug atm.

Updated module to fix Unhandled rejection ReferenceError: message is not defined errors! I didn't test it, but it should work...

Yeah, It's working for whisper and private chat now, Thanks.

Solved, check #5.