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 conteneur
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é
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
salixor
matrix-appservice-discord
Validations
df126c75
Valider
df126c75
rédigé
4 years ago
par
Will Hunt
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
fix tests
parent
51dfa6cc
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
3
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
src/clientfactory.ts
+3
-3
3 ajouts, 3 suppressions
src/clientfactory.ts
src/db/sqlite3.ts
+3
-5
3 ajouts, 5 suppressions
src/db/sqlite3.ts
test/mocks/discordclient.ts
+11
-0
11 ajouts, 0 suppression
test/mocks/discordclient.ts
avec
17 ajouts
et
8 suppressions
src/clientfactory.ts
+
3
−
3
Voir le fichier @
df126c75
...
@@ -44,7 +44,7 @@ export class DiscordClientFactory {
...
@@ -44,7 +44,7 @@ export class DiscordClientFactory {
messageCacheLifetime
:
5
,
messageCacheLifetime
:
5
,
ws
:
{
ws
:
{
intents
:
this
.
config
.
usePriviledgedIntents
?
Intents
.
PRIVILEGED
:
Intents
.
NON_PRIVILEGED
,
intents
:
this
.
config
.
usePriviledgedIntents
?
Intents
.
PRIVILEGED
:
Intents
.
NON_PRIVILEGED
,
}
}
,
});
});
const
waitPromise
=
new
Promise
((
resolve
,
reject
)
=>
{
const
waitPromise
=
new
Promise
((
resolve
,
reject
)
=>
{
...
@@ -70,7 +70,7 @@ export class DiscordClientFactory {
...
@@ -70,7 +70,7 @@ export class DiscordClientFactory {
messageCacheLifetime
:
5
,
messageCacheLifetime
:
5
,
ws
:
{
ws
:
{
intents
:
Intents
.
NON_PRIVILEGED
,
intents
:
Intents
.
NON_PRIVILEGED
,
}
}
,
});
});
await
client
.
login
(
token
,
false
);
await
client
.
login
(
token
,
false
);
...
@@ -103,7 +103,7 @@ export class DiscordClientFactory {
...
@@ -103,7 +103,7 @@ export class DiscordClientFactory {
messageCacheLifetime
:
5
,
messageCacheLifetime
:
5
,
ws
:
{
ws
:
{
intents
:
Intents
.
NON_PRIVILEGED
,
intents
:
Intents
.
NON_PRIVILEGED
,
}
}
,
});
});
const
jsLog
=
new
Log
(
"
discord.js-ppt
"
);
const
jsLog
=
new
Log
(
"
discord.js-ppt
"
);
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/db/sqlite3.ts
+
3
−
5
Voir le fichier @
df126c75
...
@@ -15,20 +15,18 @@ limitations under the License.
...
@@ -15,20 +15,18 @@ limitations under the License.
*/
*/
import
*
as
BetterSQLite3
from
"
better-sqlite3
"
;
import
*
as
BetterSQLite3
from
"
better-sqlite3
"
;
import
{
Database
}
from
"
better-sqlite3
"
;
import
{
Log
}
from
"
../log
"
;
import
{
Log
}
from
"
../log
"
;
import
{
IDatabaseConnector
,
ISqlCommandParameters
,
ISqlRow
}
from
"
./connector
"
;
import
{
IDatabaseConnector
,
ISqlCommandParameters
,
ISqlRow
}
from
"
./connector
"
;
const
log
=
new
Log
(
"
SQLite3
"
);
const
log
=
new
Log
(
"
SQLite3
"
);
export
class
SQLite3
implements
IDatabaseConnector
{
export
class
SQLite3
implements
IDatabaseConnector
{
private
db
:
Database
;
private
db
:
BetterSQLite3
.
Database
;
constructor
(
private
filename
:
string
)
{
constructor
(
private
filename
:
string
)
{
}
}
public
async
Open
()
{
public
async
Open
()
{
log
.
info
(
`Opening
${
this
.
filename
}
`
);
log
.
info
(
`Opening
${
this
.
filename
}
`
);
this
.
db
=
new
BetterSQLite3
(
this
.
filename
);
this
.
db
=
new
BetterSQLite3
(
this
.
filename
);
}
}
...
@@ -44,7 +42,7 @@ export class SQLite3 implements IDatabaseConnector {
...
@@ -44,7 +42,7 @@ export class SQLite3 implements IDatabaseConnector {
public
async
Run
(
sql
:
string
,
parameters
?:
ISqlCommandParameters
):
Promise
<
void
>
{
public
async
Run
(
sql
:
string
,
parameters
?:
ISqlCommandParameters
):
Promise
<
void
>
{
log
.
silly
(
"
Run:
"
,
sql
);
log
.
silly
(
"
Run:
"
,
sql
);
await
this
.
db
.
prepare
(
sql
).
run
(
parameters
||
[]);
this
.
db
.
prepare
(
sql
).
run
(
parameters
||
[]);
}
}
public
async
Close
():
Promise
<
void
>
{
public
async
Close
():
Promise
<
void
>
{
...
@@ -53,6 +51,6 @@ export class SQLite3 implements IDatabaseConnector {
...
@@ -53,6 +51,6 @@ export class SQLite3 implements IDatabaseConnector {
public
async
Exec
(
sql
:
string
):
Promise
<
void
>
{
public
async
Exec
(
sql
:
string
):
Promise
<
void
>
{
log
.
silly
(
"
Exec:
"
,
sql
);
log
.
silly
(
"
Exec:
"
,
sql
);
await
this
.
db
.
exec
(
sql
);
this
.
db
.
exec
(
sql
);
}
}
}
}
Ce diff est replié.
Cliquez pour l'agrandir.
test/mocks/discordclient.ts
+
11
−
0
Voir le fichier @
df126c75
...
@@ -55,6 +55,14 @@ export class MockDiscordClient {
...
@@ -55,6 +55,14 @@ export class MockDiscordClient {
this
.
testCallbacks
.
set
(
event
,
callback
);
this
.
testCallbacks
.
set
(
event
,
callback
);
}
}
public
once
(
event
:
string
,
callback
:
(...
data
:
any
[])
=>
void
)
{
this
.
testCallbacks
.
set
(
event
,
()
=>
{
this
.
testCallbacks
.
delete
(
event
);
callback
();
});
}
public
async
emit
(
event
:
string
,
...
data
:
any
[])
{
public
async
emit
(
event
:
string
,
...
data
:
any
[])
{
return
await
this
.
testCallbacks
.
get
(
event
)
!
.
apply
(
this
,
data
);
return
await
this
.
testCallbacks
.
get
(
event
)
!
.
apply
(
this
,
data
);
}
}
...
@@ -67,6 +75,9 @@ export class MockDiscordClient {
...
@@ -67,6 +75,9 @@ export class MockDiscordClient {
if
(
this
.
testCallbacks
.
has
(
"
ready
"
))
{
if
(
this
.
testCallbacks
.
has
(
"
ready
"
))
{
this
.
testCallbacks
.
get
(
"
ready
"
)
!
();
this
.
testCallbacks
.
get
(
"
ready
"
)
!
();
}
}
if
(
this
.
testCallbacks
.
has
(
"
shardReady
"
))
{
this
.
testCallbacks
.
get
(
"
shardReady
"
)
!
();
}
return
;
return
;
}
}
...
...
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