Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
b63964a
Mostly works. Have not tested channels yet
Suppen Jan 7, 2019
42bcdd2
Channels now appear to work, with a small hack
Suppen Jan 18, 2019
2961667
Updated dependencies
Suppen Jan 18, 2019
e916d21
Made a dockerfile
Suppen Jan 19, 2019
560eefe
Made a README file on how to use Docker
Suppen Jan 19, 2019
3d074bf
Set an abritrary version
Suppen Jan 19, 2019
86450ca
Edits now works again T2D
Suppen Feb 7, 2019
86141b1
Got rid of unnecessary comma
Suppen Feb 7, 2019
681cbf0
Moved version into package.json
Suppen Feb 7, 2019
53f5c2a
Bumped version to 0.8.1
Suppen Feb 7, 2019
68795eb
Hopefully stopped spamming with `skipOldMessages: false`
Suppen Feb 16, 2019
d132cb7
Added option to not cross-delete messages D2T
Suppen Feb 16, 2019
af8c828
Join/Leave messages again work T2D
Suppen Feb 16, 2019
6a541b5
Bumped version to 0.8.2
Suppen Feb 16, 2019
41da735
Added the crossDeleteOnTelegram option to example.settings.json
Suppen Feb 16, 2019
49fea14
FAQ about deleting messages T2D
Suppen Mar 3, 2019
49063b8
Added command-line arguments
trgwii Mar 20, 2019
cda4169
Set default and type for data-dir, added description to data-dir cli …
trgwii Mar 20, 2019
d95a40e
Some code cleaning
Suppen Mar 22, 2019
ac63109
No longer crashes if settings file is not writable
Suppen Mar 22, 2019
b20a09b
Bumped version to 0.8.3
Suppen Mar 22, 2019
9901cd1
Removed links to support chats from generic message
Suppen Apr 9, 2019
855ff92
Ignores casing on mentions
Suppen Apr 9, 2019
de6135e
Same treatment to channel names
Suppen Apr 9, 2019
6a08ab7
Moved the "Reply to @user" text out of the embed
Suppen Apr 9, 2019
87af78c
Removed settings migrations over one year old
Suppen Apr 21, 2019
5841eeb
Setting for how to display replies in Discord
Suppen Apr 21, 2019
e7a5aad
Documented the new settings
Suppen Apr 21, 2019
9e91774
Added the new settings to the example settings file
Suppen Apr 21, 2019
89aa6dc
0.8.4
Suppen Apr 21, 2019
9ac6eb5
Updated vulnerable dependency
Suppen Apr 21, 2019
65d10cd
0.8.5
Suppen Apr 21, 2019
37615c0
Moved the documentation of the new settings to its proper place
Suppen Apr 21, 2019
ae6c94d
Option to ignore commands on Telegram
Suppen Apr 22, 2019
f53c0ba
Moved the `ignoreCommands` setting to per-bridge
Suppen Apr 22, 2019
335cd80
Merge branch 'development'
Suppen Apr 22, 2019
5c3f103
0.8.6
Suppen Apr 22, 2019
8684639
Fixed bug which caused T2D to crash on non-text messages
Suppen Apr 22, 2019
4d08134
Fixed rogue `/`s appearing on usernames in replies
Suppen Apr 22, 2019
104ee0f
0.8.7
Suppen Apr 22, 2019
ab82833
Channel matching is now case sensitive
Suppen Apr 22, 2019
a1301e3
Merge branch 'master' into development
Suppen Apr 22, 2019
ef49dad
Correct the case of the chatinfo message.
teejo75 Apr 24, 2019
3ec8bd2
Merge pull request #108 from teejo75/patch-1
Suppen Apr 24, 2019
451ee96
Fix sticker thumbnails being sent instead of sticker images
trgwii May 15, 2019
2f3ac40
0.8.8
trgwii May 15, 2019
5f5075c
Removed symlink from docker. Replaced by command line parameter
Suppen May 26, 2019
673cb80
Updated dependencies
Suppen May 26, 2019
d4a8560
Started using middlewares on telegram bot
Suppen May 26, 2019
93a48cb
Simplified bridgegetting
Suppen May 26, 2019
dc0d74b
More middlewareification
Suppen May 26, 2019
57ed720
More TG middlewares massaging the message
Suppen May 27, 2019
a7cfb89
Merge branch 'master' into development
Suppen May 27, 2019
915ea71
Got it mostly working again
Suppen May 27, 2019
514277b
More middleware stuff and tried nesting up logic
Suppen May 28, 2019
1513ce1
Got the header correct for replies
Suppen Jun 1, 2019
45da05c
Replies now work well
Suppen Jun 2, 2019
d67144d
No longer crashes when replying to messages more than 2048 chars
Suppen Jun 2, 2019
fe1d830
Files work again
Suppen Jun 2, 2019
b97d3fd
Middleware for relayJoin/LeaveMessages
Suppen Jun 2, 2019
54087b2
Added endwares
Suppen Jun 2, 2019
c1ef474
Some minor cleanup
Suppen Jun 13, 2019
b1bfe82
Edits are now in the middleware flow
Suppen Jun 13, 2019
5635aaa
Removed debug message
Suppen Jun 23, 2019
c5d283f
0.9.0
Suppen Jun 23, 2019
6b0aa32
Fixed files not being sent T2D
Suppen Jun 24, 2019
350a638
0.9.1
Suppen Jun 24, 2019
8a9e2c2
Made the setting `telegram.sendEmojisWithStickers` work again
Suppen Jul 12, 2019
c5d0518
0.9.2
Suppen Jul 12, 2019
ca01324
Properly fixed previous issue
Suppen Jul 12, 2019
7dd5bb5
0.9.3
Suppen Jul 12, 2019
09e8596
Fixed typo in readme
Suppen Jul 12, 2019
7070d22
Added "support" for animated stickers
Suppen Jul 29, 2019
af92ec6
0.9.4
Suppen Jul 29, 2019
b0a603f
Removed a debug log line
Suppen Aug 3, 2019
96dc5f0
Changed name from "lib/" to "src/"
Suppen Aug 5, 2019
fd7b0f8
Now supports locations sent from Telegram
Suppen Aug 5, 2019
0bdfc0d
0.9.5
Suppen Aug 5, 2019
5814be8
Fixed issue #119
Suppen Aug 18, 2019
97f07f2
0.9.6
Suppen Aug 18, 2019
f6e0a38
The chatinfo command and result are deleted after a minute
Suppen Aug 25, 2019
479348a
"This is an instance..." now autodelets after a minute
Suppen Aug 25, 2019
bc3ee65
Updated dependencies
Suppen Aug 25, 2019
d1e684e
Dockerfile now uses the 'tedicross' user instead of rooti
Suppen Aug 25, 2019
3d531aa
0.9.7
Suppen Aug 25, 2019
4793cd5
Fixed bug with names with < in them
Suppen Oct 24, 2019
d89b220
0.9.8
Suppen Oct 24, 2019
d8e5a46
Renamed `ignoreCommands` to `relayCommands`
Suppen Nov 8, 2019
1970c23
Now actually removes the `ignoreCommands` option
Suppen Nov 8, 2019
eb2c068
Got rid of the `serverId` setting
Suppen Nov 8, 2019
c0949c6
0.9.5
Suppen Nov 8, 2019
f07c91d
Merge branch 'master' into development
Suppen Nov 8, 2019
a6b40cd
0.9.9
Suppen Nov 8, 2019
e5d4b5a
Removed last references to serverId setting
Suppen Nov 12, 2019
d5e3e38
0.9.10
Suppen Nov 12, 2019
22e3bb3
Add a link to ordinary install instructions
trgwii Jan 15, 2020
1a3ee18
Added "start-dev" command to npm
Suppen Jan 24, 2020
09ead12
More sensible error when dc channel is not found
Suppen Jan 25, 2020
33ca5e2
Improved start-dev command
Suppen Jan 26, 2020
c4e2a89
Keeps spoilers hidden in replies on Discord
Suppen Jan 26, 2020
ef9e19f
No longer spams info message when misconfigured
Suppen Jan 31, 2020
564f0cc
Added option "blockquote" as reply display on Discord
Suppen Feb 9, 2020
10d1309
Removed reply style option on Discord. It will now be blockquotes
Suppen Mar 8, 2020
4c78e43
Changed user in docker image and documented it
Suppen Mar 14, 2020
9507fec
0.9.11
Suppen Mar 14, 2020
848ba6c
Merge pull request #4 from TediCross/master
Myke500 Mar 29, 2020
da2ad78
Update package.json
Myke500 Mar 29, 2020
2e25ec9
Version Bump
Myke500 Mar 29, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:12-alpine

WORKDIR /opt/TediCross/

COPY . .

RUN npm install --production

# The node user (from node:12-alpine) has UID 1000, meaning most people with single-user systems will not have to change UID
USER node

VOLUME /opt/TediCross/data/

ENTRYPOINT /usr/local/bin/npm start -- -c data/settings.yaml
31 changes: 31 additions & 0 deletions README-Docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
TediCross with Docker
=====================

**This document assumes you know how to use [Docker](https://en.wikipedia.org/wiki/Docker_(software)). If you are completely clueless, please disregard Docker and follow the ordinary [install instructions](README.md#step-by-step-installation)**

TediCross is available as a Docker image, through [DockerHub](https://cloud.docker.com/u/tedicross/repository/docker/tedicross/tedicross)

It requires the `data/` directory to be mounted as a volume.

Unlike the non-docker version, the `settings.yaml` file must be in the `data/` directory instead of in the root of the project.

Using the official Docker image
-------------------------------

The official docker image is used like this:

```
docker run \
-v /path/to/data/:/opt/TediCross/data \
-e TELEGRAM_BOT_TOKEN="Your Telegram token" \
-e DISCORD_BOT_TOKEN="Your Discord token" \
tedicross/tedicross
```

Of course, you can add `-d` or `--rm` or a name or whatever else you want to that command

If you have the tokens in the settings file instead of reading them from the environment, you can of course drop the `-e` lines

### Permissions

The dockerfile says the container should start as the user with UID 1000. This should be fine for most single user Linux systems, but may cause problems for multi user systems. If you get a permission error when starting the container, try changing the user the container is using. Find your user's UID with the command `id -u $USER`, then add the argument `-u <UID>` to the `docker run` command. For example `docker run -u 1001 -v ...`
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Setting up the bot requires basic knowledge of the command line, which is bash o
1. Install [nodejs](https://nodejs.org)
2. Clone this git repo, or download it as a zip or whatever
3. Open a terminal and enter the repo with the [`cd`](https://en.wikipedia.org/wiki/Cd_(command)) command. Something like `cd Downloads/TediCross-master`. Your exact command may differ
4. Run the command `npm install`
4. Run the command `npm install --production`
5. Make a copy of the file `example.settings.yaml` and name it `settings.yaml`
6. Aquire a bot token for Telegram ([How to create a Telegram bot](https://core.telegram.org/bots#3-how-do-i-create-a-bot)) and put it in the settings file
- The Telegram bot must be able to access all messages. Talk to [@BotFather](https://t.me/BotFather) to disable privacy mode for the bot
Expand All @@ -39,7 +39,7 @@ Setting up the bot requires basic knowledge of the command line, which is bash o
10. Start TediCross: `npm start`
11. Ask the bots for the remaining details. In the Telegram chat and the Discord channel, write `/chatinfo`. Put the info you get in the settings file.
- If you want to bridge a Telegram group or channel, remember that the ID is negative. Include the `-` when entering it into the settings file
- It is important that the Discord IDs are wrapped with single quotes when entered into the settings file. `'244791815503347712'`, not `244791815503347712`
- It is important that the Discord channel ID is wrapped with single quotes when entered into the settings file. `'244791815503347712'`, not `244791815503347712`
12. Restart TediCross. You stop it by pressing CTRL + C in the terminal it is running in

Done! You now have a nice bridge between a Telegram chat and a Discord channel
Expand All @@ -55,11 +55,14 @@ As mentioned in the step by step installation guide, there is a settings file. H
* `useFirstNameInsteadOfUsername`: **EXPERIMENTAL** If set to `false`, the messages sent to Discord will be tagged with the sender's username. If set to `true`, the messages sent to Discord will be tagged with the sender's first name (or nickname). Note that Discord users can't @-mention Telegram users by their first name. Defaults to `false`
* `colonAfterSenderName`: Whether or not to put a colon after the name of the sender in messages from Discord to Telegram. If true, the name is displayed `Name:`. If false, it is displayed `Name`. Defaults to false
* `skipOldMessages`: Whether or not to skip through all previous messages cached from the telegram-side and start processing new messages ONLY. Defaults to true. Note that there is no guarantee the old messages will arrive at Discord in order
* `sendEmojisWithStickers`: Whether or not to send the corresponding emoji when relaying stickers to Discord
* `sendEmojiWithStickers`: Whether or not to send the corresponding emoji when relaying stickers to Discord
* `discord`: Object authorizing and defining the Discord bot's behaviour
* `token`: The Discord bot's token. It is needed for the bot to authenticate to the Discord servers and be able to send and receive messages. If set to `"env"`, TediCross will read the token from the environment variable `DISCORD_BOT_TOKEN`
* `skipOldMessages`: Whether or not to skip through all previous messages sent since the bot was last turned off and start processing new messages ONLY. Defaults to true. Note that there is no guarantee the old messages will arrive at Telegram in order. **NOTE:** [Telegram has a limit](https://core.telegram.org/bots/faq#my-bot-is-hitting-limits-how-do-i-avoid-this) on how quickly a bot can send messages. If there is a big backlog, this will cause problems
* `useNickname`: Uses the sending user's nickname instead of username when relaying messages to Telegram
* `displayTelegramReplies`: How to display Telegram replies. Either the string `blockqoute`, `inline` or `embed`
* `replyLength`: How many characters of the original message to display on replies
* `maxReplyLines`: How many lines of the original message to display on replies
* `debug`: If set to `true`, activates debugging output from the bot. Defaults to `false`
* `bridges`: An array containing all your chats and channels. For each object in this array, you should have the following properties:
* `name`: A internal name of the chat. Appears in the log
Expand All @@ -68,8 +71,8 @@ As mentioned in the step by step installation guide, there is a settings file. H
* `telegram.relayJoinMessages`: Whether or not to relay messages to Discord about people joining the Telegram chat
* `telegram.relayLeaveMessages`: Whether or not to relay messages to Discord about people leaving the Telegram chat
* `telegram.sendUsernames`: Whether or not to send the sender's name with the messages to Discord
* `discord.guild`: ID of the server the Discord end of the bridge is in. If a message to the bot originates from within this server, but not the correct channel, it is ignored, instead of triggering a reply telling the sender to get their own bot. See step 11 on how to aquire it
* `discord.channel`: ID of the channel the Discord end of the bridge is in. See step 11 on how to aquire it
* `telegram.relayCommands`: If set to `false`, messages starting with a `/` are not relayed to Discord
* `discord.channelId`: ID of the channel the Discord end of the bridge is in. See step 11 on how to aquire it
* `discord.relayJoinMessages`: Whether or not to relay messages to Telegram about people joining the Discord chat
* `discord.relayLeaveMessages`: Whether or not to relay messages to Telegram about people leaving the Discord chat
* `discord.sendUsernames`: Whether or not to send the sender's name with the messages to Telegram
Expand Down Expand Up @@ -114,6 +117,12 @@ The Telegram team unfortunately decided that bots cannot interact with each othe

See https://core.telegram.org/bots/faq#why-doesn-39t-my-bot-see-messages-from-other-bots

### Deleting a message in Telegram does not delete it in Discord

Telegram bots are unfortunately completely unable to detect when a message is deleted. There is no way to implement T2D cross-deletion until Telegram implements this.

Deleting messages D2T works.

### When running `npm install`, it complains about missing dependencies?

The [Discord library](https://discord.js.org/#/) TediCross is using has support for audio channels and voice chat. For this, it needs some additional libraries, like [node-opus](https://www.npmjs.com/package/node-opus), [libsodium](https://www.npmjs.com/package/libsodium) and others. TediCross does not do audio, so these warnings can safely be ignored
Expand Down
8 changes: 6 additions & 2 deletions example.settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,22 @@ discord:
useNickname: false
token: DISCORD_BOT_TOKEN_HERE # Discord bot tokens look like this: MjI3MDA1NzIvOBQ2MzAzMiMz.DRf-aw.N0MVYtDxXYPSQew4g2TPqvQve2c
skipOldMessages: true
displayTelegramReplies: embed
replyLength: 100
maxReplyLines: 2
bridges:
- name: Default bridge
- name: First bridge
direction: both
telegram:
chatId: TELEGRAM_CHAT_ID # Remember that Telegram group and channel IDs are negative. Include the `-` if you are bridging a group or a channel
relayJoinMessages: true
relayLeaveMessages: true
sendUsernames: true
relayCommands: true
discord:
serverId: 'DISCORD_SERVER_ID' # This ID must be wrapped in single quotes. Example: '244791815503347712'
channelId: 'DISCORD_CHANNEL_ID' # This ID must be wrapped in single quotes. Example: '244791815503347712'
relayJoinMessages: true
relayLeaveMessages: true
sendUsernames: true
crossDeleteOnTelegram: true
debug: false
78 changes: 0 additions & 78 deletions lib/telegram2discord/handleUpdates.js

This file was deleted.

106 changes: 0 additions & 106 deletions lib/telegram2discord/makeUpdateEmitter.js

This file was deleted.

Loading