Skip to content

Commit

Permalink
fix: cron backup msg and ts update
Browse files Browse the repository at this point in the history
  • Loading branch information
shotaronowhere committed Sep 27, 2023
1 parent e82ce48 commit 2e28654
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ const update = async (timestampNew: number, timestampLastUpdated: number,botaddr
else
queue.add(async () => {try{await bot.sendMessage(settings.channelID, `The dispute over the [question](${realityURL}) about [${data.moderationInfo.UserHistory.user.username}](tg://user?id=${data.moderationInfo.UserHistory.user.userID})'s conduct due to the [message](${msgLink}) ([backup](${data.moderationInfo.messageBackup})) has concluded it's current round. *${data.moderationInfo.UserHistory.user.username}*'s conduct ${data.currentRuling == 2? 'broke the rules': 'did not break the rules'}. If you think the decision is incorrect, you can request an [appeal](${disputeURL})`, settings.thread_id_notifications? {message_thread_id: Number(settings.thread_id_notifications), parse_mode: 'Markdown',disable_web_page_preview: true}: {parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
if (settings.channelID !== process.env.SUSIE_SUPPORT_EN)
queue.add(async () => {try{await bot.sendMessage(process.env.SUSIE_SUPPORT_EN, `The dispute over the [question](${realityURL}) about *${data.moderationInfo.UserHistory.user.username}*'s conduct due to the [message](${msgLink}) ([backup](${data.moderationInfo.messageBackupup})) in the group [${chatname}](${invite_url}) has concluded it's current round. *${data.moderationInfo.UserHistory.user.username}*'s conduct ${data.currentRuling == 2? 'broke the rules': 'did not break the rules'}. If you think the decision is incorrect, you can request an [appeal](${disputeURL})`, {message_thread_id: Number(process.env.JUSTICE_LEAGUE_EN), parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
queue.add(async () => {try{await bot.sendMessage(process.env.SUSIE_SUPPORT_EN, `The dispute over the [question](${realityURL}) about *${data.moderationInfo.UserHistory.user.username}*'s conduct due to the [message](${msgLink}) ([backup](${data.moderationInfo.messageBackup})) in the group [${chatname}](${invite_url}) has concluded it's current round. *${data.moderationInfo.UserHistory.user.username}*'s conduct ${data.currentRuling == 2? 'broke the rules': 'did not break the rules'}. If you think the decision is incorrect, you can request an [appeal](${disputeURL})`, {message_thread_id: Number(process.env.JUSTICE_LEAGUE_EN), parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
} else {
if (fedNotificationChannel)
queue.add(async () => {try{await bot.sendMessage(fedNotificationChannel, `La disputa sobre la [pregunta](${realityURL}) acerca de la conducta de [${data.moderationInfo.UserHistory.user.username}](tg://user?id=${data.moderationInfo.UserHistory.user.userID})'s debido al [mensaje](${msgLink}) ([backup](${data.moderationInfo.messageBackupup})) ha concluido su ronda actual. La conducta de *${data.moderationInfo.UserHistory.user.username}* ${data.currentRuling == 2? 'infringió las normas': 'no infringió las normas'}. Si crees que la decisión es incorrecta, puedes solicitar una [apelación](${disputeURL})`, {parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
queue.add(async () => {try{await bot.sendMessage(fedNotificationChannel, `La disputa sobre la [pregunta](${realityURL}) acerca de la conducta de [${data.moderationInfo.UserHistory.user.username}](tg://user?id=${data.moderationInfo.UserHistory.user.userID})'s debido al [mensaje](${msgLink}) ([backup](${data.moderationInfo.messageBackup})) ha concluido su ronda actual. La conducta de *${data.moderationInfo.UserHistory.user.username}* ${data.currentRuling == 2? 'infringió las normas': 'no infringió las normas'}. Si crees que la decisión es incorrecta, puedes solicitar una [apelación](${disputeURL})`, {parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
else
queue.add(async () => {try{await bot.sendMessage(settings.channelID, `La disputa sobre la [pregunta](${realityURL}) acerca de la conducta de [${data.moderationInfo.UserHistory.user.username}](tg://user?id=${data.moderationInfo.UserHistory.user.userID})'s debido al [mensaje](${msgLink}) ([backup](${data.moderationInfo.messageBackupup})) ha concluido su ronda actual. La conducta de *${data.moderationInfo.UserHistory.user.username}* ${data.currentRuling == 2? 'infringió las normas': 'no infringió las normas'}. Si crees que la decisión es incorrecta, puedes solicitar una [apelación](${disputeURL})`, settings.thread_id_notifications? {message_thread_id: Number(settings.thread_id_notifications), parse_mode: 'Markdown',disable_web_page_preview: true}: {parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
queue.add(async () => {try{await bot.sendMessage(settings.channelID, `La disputa sobre la [pregunta](${realityURL}) acerca de la conducta de [${data.moderationInfo.UserHistory.user.username}](tg://user?id=${data.moderationInfo.UserHistory.user.userID})'s debido al [mensaje](${msgLink}) ([backup](${data.moderationInfo.messageBackup})) ha concluido su ronda actual. La conducta de *${data.moderationInfo.UserHistory.user.username}* ${data.currentRuling == 2? 'infringió las normas': 'no infringió las normas'}. Si crees que la decisión es incorrecta, puedes solicitar una [apelación](${disputeURL})`, settings.thread_id_notifications? {message_thread_id: Number(settings.thread_id_notifications), parse_mode: 'Markdown',disable_web_page_preview: true}: {parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
if (settings.channelID !== process.env.SUSIE_SUPPORT_ES)
queue.add(async () => {try{await bot.sendMessage(process.env.SUSIE_SUPPORT_ES, `La disputa sobre la [pregunta](${realityURL}) acerca de la conducta de *${data.moderationInfo.UserHistory.user.username}* debido al [mensaje](${msgLink}) ([backup](${data.moderationInfo.messageBackupup})) en el grupo [${chatname}](${invite_url}) ha concluido su ronda actual. La conducta de *${data.moderationInfo.UserHistory.user.username}* ${data.currentRuling == 2? 'infringió las normas': 'no infringió las normas'}. Si crees que la decisión es incorrecta, puedes solicitar una [apelación](${disputeURL})`, {message_thread_id: Number(process.env.JUSTICE_LEAGUE_ES), parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
queue.add(async () => {try{await bot.sendMessage(process.env.SUSIE_SUPPORT_ES, `La disputa sobre la [pregunta](${realityURL}) acerca de la conducta de *${data.moderationInfo.UserHistory.user.username}* debido al [mensaje](${msgLink}) ([backup](${data.moderationInfo.messageBackup})) en el grupo [${chatname}](${invite_url}) ha concluido su ronda actual. La conducta de *${data.moderationInfo.UserHistory.user.username}* ${data.currentRuling == 2? 'infringió las normas': 'no infringió las normas'}. Si crees que la decisión es incorrecta, puedes solicitar una [apelación](${disputeURL})`, {message_thread_id: Number(process.env.JUSTICE_LEAGUE_ES), parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
}
} catch(e){
console.log(e)
Expand Down Expand Up @@ -209,8 +209,8 @@ const update = async (timestampNew: number, timestampLastUpdated: number,botaddr

for (const data of moderationActions.disputesAppeal) {
isUpdated = true
if (data.timestampLastAppealPossible > timestampUpdated)
timestampUpdated = data.timestampLastAppealPossible
if (data.timestampLastAppeal > timestampUpdated)
timestampUpdated = data.timestampLastAppeal
const settings = validate(data.moderationInfo.UserHistory.group.groupID);
const fedNotificationChannel = settings.federation_id ? getFederationChannel(db, 'telegram',settings.federation_id) : ""

Expand All @@ -227,18 +227,18 @@ const update = async (timestampNew: number, timestampLastUpdated: number,botaddr
const invite_url= isPrivate? '' : `https://t.me/${chatobj?.active_usernames[0]}`
if (settings.lang === "en"){
if (fedNotificationChannel)
queue.add(async () => {try{await bot.sendMessage(fedNotificationChannel, `An appeal has been created in the dispute over the [question](${realityURL}) about [${data.moderationInfo.UserHistory.user.username}](tg://user?id=${data.moderationInfo.UserHistory.user.userID})'s conduct due to the [message](${msgLink}) ([backup](${data.moderationInfo.messageBackupup})).`, {parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
queue.add(async () => {try{await bot.sendMessage(fedNotificationChannel, `An appeal has been created in the dispute over the [question](${realityURL}) about [${data.moderationInfo.UserHistory.user.username}](tg://user?id=${data.moderationInfo.UserHistory.user.userID})'s conduct due to the [message](${msgLink}) ([backup](${data.moderationInfo.messageBackup})).`, {parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
else
queue.add(async () => {try{await bot.sendMessage(settings.channelID, `An appeal has been created in the dispute over the [question](${realityURL}) about [${data.moderationInfo.UserHistory.user.username}](tg://user?id=${data.moderationInfo.UserHistory.user.userID})'s conduct due to the [message](${msgLink}) ([backup](${data.moderationInfo.messageBackupup})).`, settings.thread_id_notifications? {message_thread_id: Number(settings.thread_id_notifications), parse_mode: 'Markdown',disable_web_page_preview: true}: {parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
queue.add(async () => {try{await bot.sendMessage(settings.channelID, `An appeal has been created in the dispute over the [question](${realityURL}) about [${data.moderationInfo.UserHistory.user.username}](tg://user?id=${data.moderationInfo.UserHistory.user.userID})'s conduct due to the [message](${msgLink}) ([backup](${data.moderationInfo.messageBackup})).`, settings.thread_id_notifications? {message_thread_id: Number(settings.thread_id_notifications), parse_mode: 'Markdown',disable_web_page_preview: true}: {parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
if (settings.channelID !== process.env.SUSIE_SUPPORT_EN)
queue.add(async () => {try{await bot.sendMessage(process.env.SUSIE_SUPPORT_EN, `An appeal has created in the dispute over the [question](${realityURL}) about *${data.moderationInfo.UserHistory.user.username}*'s conduct due to the [message](${msgLink}) ([backup](${data.moderationInfo.messageBackupup})) in the group ${chatname}[${invite_url}].`, {message_thread_id: Number(process.env.JUSTICE_LEAGUE_EN), parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
queue.add(async () => {try{await bot.sendMessage(process.env.SUSIE_SUPPORT_EN, `An appeal has created in the dispute over the [question](${realityURL}) about *${data.moderationInfo.UserHistory.user.username}*'s conduct due to the [message](${msgLink}) ([backup](${data.moderationInfo.messageBackup})) in the group ${chatname}[${invite_url}].`, {message_thread_id: Number(process.env.JUSTICE_LEAGUE_EN), parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
} else {
if (fedNotificationChannel)
queue.add(async () => {try{await bot.sendMessage(fedNotificationChannel, `Se ha creado una apelación en la disputa sobre la [pregunta](${realityURL}) acerca de la conducta de [${data.moderationInfo.UserHistory.user.username}](tg://user?id=${data.moderationInfo.UserHistory.user.userID})'s debido al [mensaje](${msgLink}) ([backup](${data.moderationInfo.messageBackupup})).`, {parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
queue.add(async () => {try{await bot.sendMessage(fedNotificationChannel, `Se ha creado una apelación en la disputa sobre la [pregunta](${realityURL}) acerca de la conducta de [${data.moderationInfo.UserHistory.user.username}](tg://user?id=${data.moderationInfo.UserHistory.user.userID})'s debido al [mensaje](${msgLink}) ([backup](${data.moderationInfo.messageBackup})).`, {parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
else
queue.add(async () => {try{await bot.sendMessage(settings.channelID, `Se ha creado una apelación en la disputa sobre la [pregunta](${realityURL}) acerca de la conducta de [${data.moderationInfo.UserHistory.user.username}](tg://user?id=${data.moderationInfo.UserHistory.user.userID})'s debido al [mensaje](${msgLink}) ([backup](${data.moderationInfo.messageBackupup})).`, settings.thread_id_notifications? {message_thread_id: Number(settings.thread_id_notifications), parse_mode: 'Markdown',disable_web_page_preview: true}: {parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
queue.add(async () => {try{await bot.sendMessage(settings.channelID, `Se ha creado una apelación en la disputa sobre la [pregunta](${realityURL}) acerca de la conducta de [${data.moderationInfo.UserHistory.user.username}](tg://user?id=${data.moderationInfo.UserHistory.user.userID})'s debido al [mensaje](${msgLink}) ([backup](${data.moderationInfo.messageBackup})).`, settings.thread_id_notifications? {message_thread_id: Number(settings.thread_id_notifications), parse_mode: 'Markdown',disable_web_page_preview: true}: {parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
if (settings.channelID !== process.env.SUSIE_SUPPORT_ES)
queue.add(async () => {try{await bot.sendMessage(process.env.SUSIE_SUPPORT_ES, `Se ha creado una apelación en la disputa sobre la [pregunta](${realityURL}) acerca de la conducta de *${data.moderationInfo.UserHistory.user.username}* debido al [mensaje](${msgLink}) ([backup](${data.moderationInfo.messageBackupup})) en el grupo ${chatname}[${invite_url}].`, {message_thread_id: Number(process.env.JUSTICE_LEAGUE_ES), parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
queue.add(async () => {try{await bot.sendMessage(process.env.SUSIE_SUPPORT_ES, `Se ha creado una apelación en la disputa sobre la [pregunta](${realityURL}) acerca de la conducta de *${data.moderationInfo.UserHistory.user.username}* debido al [mensaje](${msgLink}) ([backup](${data.moderationInfo.messageBackup})) en el grupo ${chatname}[${invite_url}].`, {message_thread_id: Number(process.env.JUSTICE_LEAGUE_ES), parse_mode: 'Markdown',disable_web_page_preview: true})}catch{}});
}
} catch(e){
console.log(e)
Expand Down

0 comments on commit 2e28654

Please sign in to comment.