Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Dockerfiles
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Picasoft
Technique
Dockerfiles
Commits
f4dbbbd4
Commit
f4dbbbd4
authored
7 years ago
by
Antoine Barbare
Browse files
Options
Downloads
Patches
Plain Diff
Bot discussion
parent
206b8937
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pica-bot/picasoft/plugins/discussion.py
+20
-0
20 additions, 0 deletions
pica-bot/picasoft/plugins/discussion.py
pica-bot/picasoft/plugins/link.py
+6
-1
6 additions, 1 deletion
pica-bot/picasoft/plugins/link.py
with
26 additions
and
1 deletion
pica-bot/picasoft/plugins/discussion.py
0 → 100644
+
20
−
0
View file @
f4dbbbd4
# -*- coding: utf-8 -*-
import
re
from
mattermost_bot.bot
import
listen_to
from
mattermost_bot.bot
import
respond_to
@listen_to
(
'
hello|salut|yo
'
,
re
.
IGNORECASE
)
@respond_to
(
'
hello|salut|yo
'
,
re
.
IGNORECASE
)
def
hello_comment
(
message
):
message
.
comment
(
'
Hey salut :wave:
'
)
@respond_to
(
'
merci|thanks
'
,
re
.
IGNORECASE
)
def
thanks_comment
(
message
):
message
.
comment
(
'
No problemo :relaxed:
'
)
@respond_to
(
'
help|aide
'
)
def
help
(
message
):
message
.
comment
(
'
Salut je suis le bot de Picasoft
\n
Pour le moment, je sais réduire des liens avec la commande `\link <url> [<affichage>]`
'
)
This diff is collapsed.
Click to expand it.
pica-bot/picasoft/plugins/link.py
+
6
−
1
View file @
f4dbbbd4
# -*- coding: utf-8 -*-
import
re
from
mattermost_bot.bot
import
listen_to
from
mattermost_bot.bot
import
respond_to
import
requests
import
json
from
mattermost_bot.bot
import
listen_to
@listen_to
(
'
\\
\link ^(http[s]?://[\S]*) (.*)*$
'
)
@respond_to
(
'
\\
\link ^(http[s]?://[\S]*) (.*)*$
'
)
def
link_display
(
message
,
url
,
display
):
payload
=
{
'
lsturl
'
:
url
,
...
...
@@ -16,6 +19,7 @@ def link_display(message, url, display):
message
.
comment
(
'
[
'
+
display
+
'
]
'
+
'
(
'
+
r
[
'
short
'
]
+
'
)
'
)
@listen_to
(
'
\\
\link ^(http[s]?://[\S]*)$
'
)
@respond_to
(
'
\\
\link ^(http[s]?://[\S]*)$
'
)
def
link
(
message
,
url
):
payload
=
{
'
lsturl
'
:
url
,
...
...
@@ -27,6 +31,7 @@ def link(message, url):
@listen_to
(
'
\\
\link (.*
\\
n)*
'
)
@respond_to
(
'
\\
\link (.*
\\
n)*
'
)
def
link_multiple
(
message
,
opt
):
for
elt
in
message
.
get_message
().
split
(
'
\n
'
):
mes
=
elt
.
replace
(
'
\\
link
'
,
''
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment