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. ...@@ -9,16 +9,16 @@ A very WIP bridge between Matrix and Discord in node.
- [ ] Initiating - [ ] Initiating
- Matrix -> Discord - Matrix -> Discord
- [x] Text content - [x] Text content
- [ ] Image content - [x] Image content
- [ ] Audio/Video content - [x] Audio/Video content
- [ ] Typing notifs - [ ] Typing notifs (**Not supported, requires syncing**)
- [x] User Profiles - [x] User Profiles
- Discord -> Matrix - Discord -> Matrix
- [x] Text content - [x] Text content
- [ ] Image content - [x] Image content
- [ ] Audio/Video content - [x] Audio/Video content
- [x] Typing notifs - [x] Typing notifs
- [ ] User Profiles - [x] User Profiles
- [ ] Presence - [ ] Presence
- [ ] Webhooks (allows for prettier messages to discord) - [ ] Webhooks (allows for prettier messages to discord)
- [ ] Rooms react to Discord updates - [ ] Rooms react to Discord updates
......
...@@ -52,13 +52,10 @@ export class DiscordBot { ...@@ -52,13 +52,10 @@ export class DiscordBot {
} }
public ProcessMatrixMsgEvent(event, guild_id: string, channel_id: string): Promise<any> { 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 chan;
let embed; let embed;
const mxClient = this.bridge.getClientFactory().getClientAs(); 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; chan = channel;
return mxClient.getProfileInfo(event.sender); return mxClient.getProfileInfo(event.sender);
}).then((profile) => { }).then((profile) => {
...@@ -77,7 +74,7 @@ export class DiscordBot { ...@@ -77,7 +74,7 @@ export class DiscordBot {
}, },
description: event.content.body, 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)); return Util.DownloadFile(mxClient.mxcUrlToHttp(event.content.url));
} }
else { else {
...@@ -95,7 +92,6 @@ export class DiscordBot { ...@@ -95,7 +92,6 @@ export class DiscordBot {
return {} return {}
}).then((opts) => { }).then((opts) => {
chan.sendEmbed(embed, opts); chan.sendEmbed(embed, opts);
log.info("DiscordBot", "Outgoing Message ", embed);
}).catch((err) => { }).catch((err) => {
log.error("DiscordBot", "Couldn't send message. ", 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