Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wantzel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
9
Issues
9
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
La Quadrature du Net
rpteam
wantzel
Commits
b4eac9cc
Commit
b4eac9cc
authored
Apr 06, 2018
by
Mindiell
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 'master'
ajout d'un flag media See merge request
!5
parents
272458d0
08846ff0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
create_mysql_tables.sql
create_mysql_tables.sql
+1
-0
messages.py
messages.py
+1
-1
wantzel.py
wantzel.py
+10
-4
No files found.
create_mysql_tables.sql
View file @
b4eac9cc
...
...
@@ -17,6 +17,7 @@ CREATE TABLE IF NOT EXISTS `presse` (
`date_publi`
datetime
DEFAULT
NULL
,
`hat`
text
,
`media`
varchar
(
50
)
DEFAULT
NULL
,
`is_media`
tinyint
(
1
)
NOT
NULL
DEFAULT
'0'
,
PRIMARY
KEY
(
`id`
),
KEY
`note`
(
`note`
)
)
ENGINE
=
MyISAM
AUTO_INCREMENT
=
24233
DEFAULT
CHARSET
=
latin1
messages.py
View file @
b4eac9cc
...
...
@@ -9,7 +9,7 @@ messages = {
"""Bonjour, je suis le bot de la Quadrature du Net, vous pouvez me demander de l'aide si besoin. (wantzel help)"""
,
"help"
:
"""Mes commandes sont : ~help ~rp(cpa) ~status ~kill ~stats et ~admin.
"""Mes commandes sont : ~help ~rp(cpa
m
) ~status ~kill ~stats et ~admin.
Pour plus d'informations, voir ici: https://wiki.laquadrature.net/Wantzel
Pour obtenir de l'aide sur une commande en particulier, il suffit de taper ~help <commande>"""
,
...
...
wantzel.py
View file @
b4eac9cc
...
...
@@ -368,7 +368,7 @@ class Wantzel(object):
if
"wantzel"
in
msg
and
(
"help"
in
msg
or
"aide"
in
msg
):
self
.
help
(
user
,
channel
,
msg
)
# Find known command
command
=
re
.
search
(
"[!~](rp[acp]*|status|kill|help|stats|admin)"
,
msg
)
command
=
re
.
search
(
"[!~](rp[acp
m
]*|status|kill|help|stats|admin)"
,
msg
)
Utils
.
debug
(
"Command: %s"
%
command
)
if
command
:
Utils
.
debug
(
"group(0): %s"
%
command
.
group
(
0
))
...
...
@@ -433,6 +433,7 @@ class Wantzel(object):
Utils
.
debug
(
"rp msg : %s"
%
msg
)
cite
=
0
note
=
1
is_media
=
0
answer
=
False
url
=
get_url
(
msg
)
Utils
.
debug
(
"url: %s"
%
url
)
...
...
@@ -449,6 +450,9 @@ class Wantzel(object):
# Archive this article
if
"a"
in
command
:
cite
+=
4
# this is media
if
"m"
in
command
:
is_media
=
1
# Looking for such an article in database
cursor
=
get_cursor
()
...
...
@@ -470,9 +474,9 @@ class Wantzel(object):
cursor
.
execute
(
"""
INSERT INTO presse SET
url=%s, provenance=%s, cite=%s, note=%s, datec=NOW(), title='',
lang='', published=0, nid=0, screenshot=0, fetched=0, seemscite=0
lang='', published=0, nid=0, screenshot=0, fetched=0, seemscite=0
, is_media=%s
"""
,
(
url
,
user
,
cite
,
note
)
(
url
,
user
,
cite
,
note
,
is_media
)
)
answer
=
True
else
:
...
...
@@ -586,7 +590,7 @@ class Wantzel(object):
else
:
url2
=
"https"
+
url
[
4
:]
cursor
.
execute
(
"""
SELECT cite, nid, note
SELECT cite, nid, note
, is_media
FROM presse
WHERE url = %s
OR url = %s"""
,
...
...
@@ -607,6 +611,8 @@ class Wantzel(object):
message
+=
"publié (https://laquadrature.net/node/%s) / "
%
rows
[
0
][
1
]
else
:
message
+=
"non publié / "
if
rows
[
0
][
3
]
==
1
:
message
+=
"media / "
self
.
send_message
(
channel
,
message
[:
-
3
])
def
kill
(
self
,
user
,
channel
,
msg
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment