Skip to content
Extraits de code Groupes Projets
Valider d088da41 rédigé par Will Hunt's avatar Will Hunt
Parcourir les fichiers

Add support for file uploads

parent 4c71faea
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -9,16 +9,16 @@ A very WIP bridge between Matrix and Discord in node.
- [ ] Initiating
- Matrix -> Discord
- [x] Text content
- [ ] Image content
- [ ] Audio/Video content
- [ ] Typing notifs
- [x] Image content
- [x] Audio/Video content
- [ ] Typing notifs (**Not supported, requires syncing**)
- [x] User Profiles
- Discord -> Matrix
- [x] Text content
- [ ] Image content
- [ ] Audio/Video content
- [x] Image content
- [x] Audio/Video content
- [x] Typing notifs
- [ ] User Profiles
- [x] User Profiles
- [ ] Presence
- [ ] Webhooks (allows for prettier messages to discord)
- [ ] Rooms react to Discord updates
......
......@@ -52,13 +52,10 @@ export class DiscordBot {
}
public ProcessMatrixMsgEvent(event, guild_id: string, channel_id: string): Promise<any> {
if (["m.text", "m.image"].indexOf(event.content.msgtype) === -1) {
return Promise.reject("The AS doesn't support non m.text messages");
}
let chan;
let embed;
const mxClient = this.bridge.getClientFactory().getClientAs();
this.LookupRoom(guild_id, channel_id).then((channel) => {
return this.LookupRoom(guild_id, channel_id).then((channel) => {
chan = channel;
return mxClient.getProfileInfo(event.sender);
}).then((profile) => {
......@@ -77,7 +74,7 @@ export class DiscordBot {
},
description: event.content.body,
});
if (event.content.msgtype === "m.image") {
if (["m.image", "m.audio", "m.video", "m.file"].indexOf(event.content.msgtype) !== -1) {
return Util.DownloadFile(mxClient.mxcUrlToHttp(event.content.url));
}
else {
......@@ -95,7 +92,6 @@ export class DiscordBot {
return {}
}).then((opts) => {
chan.sendEmbed(embed, opts);
log.info("DiscordBot", "Outgoing Message ", embed);
}).catch((err) => {
log.error("DiscordBot", "Couldn't send message. ", err);
});
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter