Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
M
matrix-appservice-discord
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneurs
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
salixor
matrix-appservice-discord
Validations
40e9198d
Valider
40e9198d
rédigé
Il y a 6 ans
par
Will Hunt
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Provisioner support for room store
parent
0712406e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
src/discordas.ts
+1
-1
1 ajout, 1 suppression
src/discordas.ts
src/provisioner.ts
+6
-6
6 ajouts, 6 suppressions
src/provisioner.ts
avec
7 ajouts
et
7 suppressions
src/discordas.ts
+
1
−
1
Voir le fichier @
40e9198d
...
@@ -122,7 +122,6 @@ async function run(port: number, fileConfig: DiscordBridgeConfig) {
...
@@ -122,7 +122,6 @@ async function run(port: number, fileConfig: DiscordBridgeConfig) {
userStore
:
config
.
database
.
userStorePath
,
userStore
:
config
.
database
.
userStorePath
,
// To avoid out of order message sending.
// To avoid out of order message sending.
});
});
provisioner
.
SetBridge
(
bridge
);
roomhandler
.
setBridge
(
bridge
);
roomhandler
.
setBridge
(
bridge
);
discordbot
.
setBridge
(
bridge
);
discordbot
.
setBridge
(
bridge
);
discordbot
.
setRoomHandler
(
roomhandler
);
discordbot
.
setRoomHandler
(
roomhandler
);
...
@@ -134,6 +133,7 @@ async function run(port: number, fileConfig: DiscordBridgeConfig) {
...
@@ -134,6 +133,7 @@ async function run(port: number, fileConfig: DiscordBridgeConfig) {
log
.
info
(
"
Initing store.
"
);
log
.
info
(
"
Initing store.
"
);
await
discordstore
.
init
();
await
discordstore
.
init
();
log
.
info
(
"
Initing bot.
"
);
log
.
info
(
"
Initing bot.
"
);
provisioner
.
setStore
(
discordstore
.
roomStore
);
await
discordbot
.
run
();
await
discordbot
.
run
();
log
.
info
(
"
Discordbot started successfully.
"
);
log
.
info
(
"
Discordbot started successfully.
"
);
}
catch
(
err
)
{
}
catch
(
err
)
{
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/provisioner.ts
+
6
−
6
Voir le fichier @
40e9198d
...
@@ -20,16 +20,17 @@ import {
...
@@ -20,16 +20,17 @@ import {
MatrixRoom
,
MatrixRoom
,
}
from
"
matrix-appservice-bridge
"
;
}
from
"
matrix-appservice-bridge
"
;
import
*
as
Discord
from
"
discord.js
"
;
import
*
as
Discord
from
"
discord.js
"
;
import
{
DbRoomStore
}
from
"
./db/roomstore
"
;
const
PERMISSION_REQUEST_TIMEOUT
=
300000
;
// 5 minutes
const
PERMISSION_REQUEST_TIMEOUT
=
300000
;
// 5 minutes
export
class
Provisioner
{
export
class
Provisioner
{
private
bridge
:
Bridge
;
private
pendingRequests
:
Map
<
string
,
(
approved
:
boolean
)
=>
void
>
=
new
Map
();
// [channelId]: resolver fn
private
pendingRequests
:
Map
<
string
,
(
approved
:
boolean
)
=>
void
>
=
new
Map
();
// [channelId]: resolver fn
private
roomStore
:
DbRoomStore
;
public
SetBridge
(
bridge
:
Bridge
):
void
{
public
setStore
(
roomStore
:
DbRoomStore
)
{
this
.
bridge
=
bridg
e
;
this
.
roomStore
=
roomStor
e
;
}
}
public
BridgeMatrixRoom
(
channel
:
Discord
.
TextChannel
,
roomId
:
string
)
{
public
BridgeMatrixRoom
(
channel
:
Discord
.
TextChannel
,
roomId
:
string
)
{
...
@@ -40,12 +41,11 @@ export class Provisioner {
...
@@ -40,12 +41,11 @@ export class Provisioner {
remote
.
set
(
"
plumbed
"
,
true
);
remote
.
set
(
"
plumbed
"
,
true
);
const
local
=
new
MatrixRoom
(
roomId
);
const
local
=
new
MatrixRoom
(
roomId
);
this
.
bridge
.
getRoomStore
().
linkRooms
(
local
,
remote
);
this
.
roomStore
.
linkRooms
(
local
,
remote
);
this
.
bridge
.
getRoomStore
().
setMatrixRoom
(
local
);
// Needs to be done after linking
}
}
public
UnbridgeRoom
(
remoteRoom
:
RemoteRoom
)
{
public
UnbridgeRoom
(
remoteRoom
:
RemoteRoom
)
{
return
this
.
bridge
.
getR
oomStore
()
.
removeEntriesByRemoteRoomId
(
remoteRoom
.
getId
());
return
this
.
r
oomStore
.
removeEntriesByRemoteRoomId
(
remoteRoom
.
getId
());
}
}
public
async
AskBridgePermission
(
public
async
AskBridgePermission
(
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter