|
@@ -4,7 +4,7 @@ import * as Twitter from 'twitter';
|
|
|
import TwitterTypes from 'twitter-d';
|
|
|
|
|
|
import { getLogger } from './loggers';
|
|
|
-import QQBot, { Message } from './koishi';
|
|
|
+import QQBot from './koishi';
|
|
|
import { chainPromises, BigNumOps } from './utils';
|
|
|
import Webshot from './webshot';
|
|
|
|
|
@@ -276,16 +276,15 @@ export default class {
|
|
|
|
|
|
private sendTweets = (source?: string, ...to: IChat[]) => (msg: string, text: string, author: string) => {
|
|
|
to.forEach(subscriber => {
|
|
|
- logger.info(`pushing data${source ? ` of ${Message.ellipseBase64(source)}` : ''} to ${JSON.stringify(subscriber)}`);
|
|
|
+ logger.info(`pushing data${source ? ` of ${source}` : ''} to ${JSON.stringify(subscriber)}`);
|
|
|
retryOnError(
|
|
|
() => this.bot.sendTo(subscriber, msg),
|
|
|
(_, count, terminate: (doNothing: Promise<void>) => void) => {
|
|
|
if (count <= maxTrials) {
|
|
|
logger.warn(`retry sending to ${subscriber.chatID} for the ${ordinal(count)} time...`);
|
|
|
} else {
|
|
|
- logger.warn(`${count - 1} consecutive failures while sending` +
|
|
|
- 'message chain, trying plain text instead...');
|
|
|
- terminate(this.bot.sendTo(subscriber, author + text));
|
|
|
+ logger.warn(`${count - 1} consecutive failures while sending message chain, trying plain text instead...`);
|
|
|
+ terminate(this.bot.sendTo(subscriber, author + text, true));
|
|
|
}
|
|
|
});
|
|
|
});
|