Skip to content

Commit

Permalink
fix: unintended reply
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby committed Aug 16, 2023
1 parent 4845020 commit 59107b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "tedicross",
"version": "0.11.4",
"version": "0.11.5",
"description": "Bridging Telegram and Discord",
"license": "MIT",
"repository": {
Expand Down
12 changes: 7 additions & 5 deletions src/discord2telegram/setup.ts
Expand Up @@ -13,6 +13,7 @@ import { BridgeMap } from "../bridgestuff/BridgeMap";
import { Telegraf } from "telegraf";
import { escapeHTMLSpecialChars, ignoreAlreadyDeletedError } from "./helpers";
import { Client, Message, TextChannel } from "discord.js";
import { MessageType } from "discord.js";
import { Settings } from "../settings/Settings";

/***********
Expand Down Expand Up @@ -291,11 +292,13 @@ export function setup(
if (!antiInfoSpamSet.has(message.channel.id)) {
antiInfoSpamSet.add(message.channel.id);

if (message.type !== MessageType.Default && message.type !== MessageType.Reply) return;

message
.reply(
"This is an instance of a TediCross bot, bridging a chat in Telegram with one in Discord. " +
"If you wish to use TediCross yourself, please download and create an instance. " +
"See https://github.com/TediCross/TediCross"
"If you wish to use TediCross yourself, please download and create an instance. " +
"See https://github.com/TediCross/TediCross"
)
// Delete it again after some time
.then(sleepOneMinute)
Expand All @@ -316,9 +319,8 @@ export function setup(
// Pass it on to the bridges
bridgeMap.fromDiscordChannelId(Number(newMessage.channel.id)).forEach(async bridge => {
try {

// Get the corresponding Telegram message ID
let [tgMessageId] = await messageMap.getCorresponding(
const [tgMessageId] = await messageMap.getCorresponding(
MessageMap.DISCORD_TO_TELEGRAM,
bridge,
newMessage.id
Expand Down Expand Up @@ -361,7 +363,7 @@ export function setup(
try {
// Get the corresponding Telegram message IDs
const tgMessageIds = isFromTelegram
? await messageMap.getCorrespondingReverse(MessageMap.DISCORD_TO_TELEGRAM, bridge, message.id)
? await messageMap.getCorrespondingReverse(MessageMap.DISCORD_TO_TELEGRAM, bridge, message.id)
: await messageMap.getCorresponding(MessageMap.DISCORD_TO_TELEGRAM, bridge, message.id);
//console.log("d2t delete: " + tgMessageIds);
// Try to delete them
Expand Down

0 comments on commit 59107b3

Please sign in to comment.