Skip to content
Extraits de code Groupes Projets
Non vérifiée Valider 2a34ba4b rédigé par Sorunome's avatar Sorunome
Parcourir les fichiers

Merge branch 'j94/copy-changes' of...

Merge branch 'j94/copy-changes' of https://github.com/jaller94/matrix-appservice-discord into develop
parents 01cd73cc 32f08c21
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -50,10 +50,10 @@ export class DiscordCommandHandler { ...@@ -50,10 +50,10 @@ export class DiscordCommandHandler {
permission: "MANAGE_WEBHOOKS", permission: "MANAGE_WEBHOOKS",
run: async () => { run: async () => {
if (await this.discord.Provisioner.MarkApproved(chan, discordMember, true)) { if (await this.discord.Provisioner.MarkApproved(chan, discordMember, true)) {
return "Thanks for your response! The matrix bridge has been approved"; return "Thanks for your response! The matrix bridge has been approved.";
} else { } else {
return "Thanks for your response, however" + return "Thanks for your response, however" +
"the time for responses has expired - sorry!"; " it has arrived after the deadline - sorry!";
} }
}, },
}, },
...@@ -69,10 +69,10 @@ export class DiscordCommandHandler { ...@@ -69,10 +69,10 @@ export class DiscordCommandHandler {
permission: "MANAGE_WEBHOOKS", permission: "MANAGE_WEBHOOKS",
run: async () => { run: async () => {
if (await this.discord.Provisioner.MarkApproved(chan, discordMember, false)) { if (await this.discord.Provisioner.MarkApproved(chan, discordMember, false)) {
return "Thanks for your response! The matrix bridge has been declined"; return "Thanks for your response! The matrix bridge has been declined.";
} else { } else {
return "Thanks for your response, however" + return "Thanks for your response, however" +
"the time for responses has expired - sorry!"; " it has arrived after the deadline - sorry!";
} }
}, },
}, },
......
...@@ -97,8 +97,8 @@ export class MatrixCommandHandler { ...@@ -97,8 +97,8 @@ export class MatrixCommandHandler {
await this.provisioner.BridgeMatrixRoom(channel, event.room_id); await this.provisioner.BridgeMatrixRoom(channel, event.room_id);
return "I have bridged this room to your channel"; return "I have bridged this room to your channel";
} catch (err) { } catch (err) {
if (err.message === "Timed out waiting for a response from the Discord owners" if (err.message === "Timed out waiting for a response from the Discord owners."
|| err.message === "The bridge has been declined by the Discord guild") { || err.message === "The bridge has been declined by the Discord guild.") {
return err.message; return err.message;
} }
......
...@@ -89,9 +89,9 @@ export class Provisioner { ...@@ -89,9 +89,9 @@ export class Provisioner {
resolve("Approved"); resolve("Approved");
} else { } else {
if (expired) { if (expired) {
reject(Error("Timed out waiting for a response from the Discord owners")); reject(Error("Timed out waiting for a response from the Discord owners."));
} else { } else {
reject(Error("The bridge has been declined by the Discord guild")); reject(Error("The bridge has been declined by the Discord guild."));
} }
} }
}; };
...@@ -100,7 +100,7 @@ export class Provisioner { ...@@ -100,7 +100,7 @@ export class Provisioner {
setTimeout(() => approveFn(false, true), timeout); setTimeout(() => approveFn(false, true), timeout);
await channel.send(`${requestor} on matrix would like to bridge this channel. Someone with permission` + await channel.send(`${requestor} on matrix would like to bridge this channel. Someone with permission` +
" to manage webhooks please reply with `!matrix approve` or `!matrix deny` in the next 5 minutes"); " to manage webhooks please reply with `!matrix approve` or `!matrix deny` in the next 5 minutes.");
return await deferP; return await deferP;
} }
......
...@@ -40,7 +40,7 @@ function createCH(opts: any = {}, shouldBeJoined = true) { ...@@ -40,7 +40,7 @@ function createCH(opts: any = {}, shouldBeJoined = true) {
const provisioner = { const provisioner = {
AskBridgePermission: async () => { AskBridgePermission: async () => {
if (opts.denyBridgePermission) { if (opts.denyBridgePermission) {
throw new Error("The bridge has been declined by the Discord guild"); throw new Error("The bridge has been declined by the Discord guild.");
} }
}, },
BridgeMatrixRoom: () => { BridgeMatrixRoom: () => {
...@@ -151,8 +151,8 @@ describe("MatrixCommandHandler", () => { ...@@ -151,8 +151,8 @@ describe("MatrixCommandHandler", () => {
denyBridgePermission: true, denyBridgePermission: true,
}); });
await handler.Process(createEvent("!discord bridge 123 456"), createContext()); await handler.Process(createEvent("!discord bridge 123 456"), createContext());
const expected = "The bridge has been declined by the Discord guild"; const expected = "The bridge has been declined by the Discord guild.";
const expectedHtml = "<p>The bridge has been declined by the Discord guild</p>\n"; const expectedHtml = "<p>The bridge has been declined by the Discord guild.</p>\n";
bridge.botIntent.underlyingClient.wasCalled("sendMessage", true, "!123:localhost", { bridge.botIntent.underlyingClient.wasCalled("sendMessage", true, "!123:localhost", {
body: expected, body: expected,
format: "org.matrix.custom.html", format: "org.matrix.custom.html",
......
...@@ -37,7 +37,7 @@ describe("Provisioner", () => { ...@@ -37,7 +37,7 @@ describe("Provisioner", () => {
); );
throw Error("Should have thrown an error"); throw Error("Should have thrown an error");
} catch (err) { } catch (err) {
expect(err.message).to.eq("Timed out waiting for a response from the Discord owners"); expect(err.message).to.eq("Timed out waiting for a response from the Discord owners.");
const delay = Date.now() - startAt; const delay = Date.now() - startAt;
if (delay < TIMEOUT_MS) { if (delay < TIMEOUT_MS) {
throw Error(`Should have waited for timeout before resolving, waited: ${delay}ms`); throw Error(`Should have waited for timeout before resolving, waited: ${delay}ms`);
...@@ -56,7 +56,7 @@ describe("Provisioner", () => { ...@@ -56,7 +56,7 @@ describe("Provisioner", () => {
await promise; await promise;
throw Error("Should have thrown an error"); throw Error("Should have thrown an error");
} catch (err) { } catch (err) {
expect(err.message).to.eq("The bridge has been declined by the Discord guild"); expect(err.message).to.eq("The bridge has been declined by the Discord guild.");
} }
}); });
......
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