Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
P
PlayBot
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
Déploiement
Releases
Registre de modèles
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
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
Alexandre MORIGNOT
PlayBot
Validations
55dcaaa2
Valider
55dcaaa2
rédigé
15 août 2013
par
Alexandre Morignot
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
All the commands works now in query
parent
7d360bcd
Branches
Branches contenant la validation
Étiquettes
Étiquettes contenant la validation
Aucune requête de fusion associée trouvée
Modifications
3
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
PlayBot.pl
+7
-2
7 ajouts, 2 suppressions
PlayBot.pl
lib/commands/get.pm
+38
-12
38 ajouts, 12 suppressions
lib/commands/get.pm
lib/commands/parser.pm
+1
-1
1 ajout, 1 suppression
lib/commands/parser.pm
avec
46 ajouts
et
15 suppressions
PlayBot.pl
+
7
−
2
Voir le fichier @
55dcaaa2
...
@@ -174,9 +174,14 @@ sub on_connect
...
@@ -174,9 +174,14 @@ sub on_connect
# Discussion privée
# Discussion privée
sub
on_query
sub
on_query
{
{
my
(
$user
,
$msg
)
=
@_
[
ARG0
,
ARG2
];
my
(
$kernel
,
$user
,
$msg
)
=
@_
[
KERNEL
,
ARG0
,
ARG2
];
my
(
$nick
)
=
split
(
/!/
,
$user
);
my
(
$nick
)
=
split
(
/!/
,
$user
);
print
$msg
.
"
\n
";
my
@fake_chan
=
(
$nick
);
my
@args
=
(
$kernel
,
$user
,
\
@fake_chan
,
$msg
);
my
$fake_chan
=
\
@fake_chan
;
return
if
(
commands::parser::
exec
(
@args
));
if
(
$msg
=~
m/^!/
&&
$nick
eq
$admin
)
{
if
(
$msg
=~
m/^!/
&&
$nick
eq
$admin
)
{
my
$commande
=
(
$msg
=~
m/^!([^ ]*)/
)[
0
];
my
$commande
=
(
$msg
=~
m/^!([^ ]*)/
)[
0
];
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
lib/commands/get.pm
+
38
−
12
Voir le fichier @
55dcaaa2
...
@@ -17,15 +17,30 @@ sub exec {
...
@@ -17,15 +17,30 @@ sub exec {
my
@tags
=
(
$msg
=~
/#?([a-zA-Z0-9_-]+)/g
);
my
@tags
=
(
$msg
=~
/#?([a-zA-Z0-9_-]+)/g
);
my
$content
;
my
$content
;
# if we are in a query, we search in all the channels
my
$all
=
(
$chan
->
[
0
]
!~
/^#/
)
?
1
:
0
;
if
(
@tags
)
{
if
(
@tags
)
{
my
$params
=
join
'
,
'
=>
('
?
')
x
@tags
;
my
$params
=
join
'
,
'
=>
('
?
')
x
@tags
;
my
$sth
=
$dbh
->
prepare
('
select id, sender, title, url from playbot
my
$sth
;
if
(
$all
)
{
$sth
=
$dbh
->
prepare
('
select id, sender, title, url from playbot
natural join playbot_tags
where tag in (
'
.
$params
.
'
)
group by id
having count(*) >= ?
');
$sth
->
execute
(
@tags
,
scalar
@tags
);
}
else
{
$sth
=
$dbh
->
prepare
('
select id, sender, title, url from playbot
natural join playbot_tags
natural join playbot_tags
where tag in (
'
.
$params
.
'
)
where tag in (
'
.
$params
.
'
)
and chan = ?
and chan = ?
group by id
group by id
having count(*) >= ?
');
having count(*) >= ?
');
$sth
->
execute
(
@tags
,
$chan
->
[
0
],
scalar
@tags
);
$sth
->
execute
(
@tags
,
$chan
->
[
0
],
scalar
@tags
);
}
$content
=
$sth
->
fetchall_arrayref
;
$content
=
$sth
->
fetchall_arrayref
;
...
@@ -38,11 +53,22 @@ sub exec {
...
@@ -38,11 +53,22 @@ sub exec {
}
}
}
}
else
{
else
{
my
$sth
=
$dbh
->
prepare
('
select id, sender, title, url from playbot
my
$sth
;
if
(
$all
)
{
$sth
=
$dbh
->
prepare
('
select id, sender, title, url from playbot
order by rand()
limit 1
');
$sth
->
execute
;
}
else
{
$sth
=
$dbh
->
prepare
('
select id, sender, title, url from playbot
where chan = ?
where chan = ?
order by rand()
order by rand()
limit 1
');
limit 1
');
$sth
->
execute
(
$chan
->
[
0
]);
$sth
->
execute
(
$chan
->
[
0
]);
}
$content
=
$sth
->
fetch
;
$content
=
$sth
->
fetch
;
if
(
!
$content
)
{
if
(
!
$content
)
{
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
lib/commands/parser.pm
+
1
−
1
Voir le fichier @
55dcaaa2
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