Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
maubot-rt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Show more breadcrumbs
isgphys
maubot-rt
Commits
c6702641
Commit
c6702641
authored
5 years ago
by
Sven Mäder
Browse files
Options
Downloads
Patches
Plain Diff
Add subcommand reply
parent
78910dab
No related branches found
Branches containing commit
Tags
0.3.0
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
maubot.yaml
+1
-1
1 addition, 1 deletion
maubot.yaml
rt.py
+33
-10
33 additions, 10 deletions
rt.py
with
34 additions
and
11 deletions
maubot.yaml
+
1
−
1
View file @
c6702641
...
...
@@ -5,7 +5,7 @@ maubot: 0.1.0
id
:
ch.ethz.phys.rt
# A PEP 440 compliant version string.
version
:
0.
2.9
version
:
0.
3.0
# The SPDX license identifier for the plugin. https://spdx.org/licenses/
# Optional, assumes all rights reserved if omitted.
...
...
This diff is collapsed.
Click to expand it.
rt.py
+
33
−
10
View file @
c6702641
...
...
@@ -96,9 +96,10 @@ class RT(Plugin):
data
=
{
**
self
.
login
,
**
content
}
await
self
.
http
.
post
(
rest
,
data
=
data
,
headers
=
self
.
headers
)
async
def
_comment
(
self
,
number
:
str
,
commen
t
:
str
)
->
None
:
async
def
_comment
(
self
,
number
:
str
,
action
:
str
,
tex
t
:
str
)
->
None
:
rest
=
f
'
{
self
.
rest
}
ticket/
{
number
}
/comment
'
content
=
{
'
content
'
:
f
'
id:
{
number
}
\n
Action: comment
\n
Text:
{
comment
}
'
}
multiline_text
=
text
.
replace
(
'
\n
'
,
'
\n
'
)
content
=
{
'
content
'
:
f
'
id:
{
number
}
\n
Action:
{
action
}
\n
Text:
{
multiline_text
}
'
}
data
=
{
**
self
.
login
,
**
content
}
await
self
.
http
.
post
(
rest
,
data
=
data
,
headers
=
self
.
headers
)
...
...
@@ -245,23 +246,45 @@ class RT(Plugin):
@rt.subcommand
(
'
queue
'
,
aliases
=
(
'
q
'
,
'
que
'
),
help
=
'
Put the ticket in queue.
'
)
@command.argument
(
'
number
'
,
'
ticket number
'
,
parser
=
str
)
@command.argument
(
'
q
ueue
'
,
'
queue
'
,
parser
=
str
)
async
def
queue
(
self
,
evt
:
MessageEvent
,
number
:
str
,
q
ueue
:
str
)
->
None
:
@command.argument
(
'
q
id
'
,
'
queue
id
'
,
parser
=
str
)
async
def
queue
(
self
,
evt
:
MessageEvent
,
number
:
str
,
q
id
:
str
)
->
None
:
if
not
self
.
can_manage
(
evt
)
or
not
self
.
valid_number
(
number
):
return
await
evt
.
mark_read
()
await
self
.
_edit
(
number
,
{
'
Status
'
:
'
open
'
,
'
Queue
'
:
q
ueue
})
await
evt
.
respond
(
f
'
{
self
.
markdown_link
(
number
)
}
queued in **
{
q
ueue
}
** 😐️
{
self
.
take_this
}
'
)
await
self
.
_edit
(
number
,
{
'
Status
'
:
'
open
'
,
'
Queue
'
:
q
id
})
await
evt
.
respond
(
f
'
{
self
.
markdown_link
(
number
)
}
queued in **
{
q
id
}
** 😐️
{
self
.
take_this
}
'
)
@rt.subcommand
(
'
comment
'
,
aliases
=
(
'
c
'
,
'
com
'
),
help
=
'
Add a comment.
'
)
@command.argument
(
'
number
'
,
'
ticket number
'
,
parser
=
str
)
@command.argument
(
'
commen
t
'
,
'
comment text
'
,
pass_raw
=
True
)
async
def
comment
(
self
,
evt
:
MessageEvent
,
number
:
str
,
commen
t
:
str
)
->
None
:
@command.argument
(
'
tex
t
'
,
'
comment text
'
,
pass_raw
=
True
)
async
def
comment
(
self
,
evt
:
MessageEvent
,
number
:
str
,
tex
t
:
str
)
->
None
:
if
not
self
.
can_manage
(
evt
)
or
not
self
.
valid_number
(
number
):
return
await
evt
.
mark_read
()
await
self
.
_comment
(
number
,
comment
)
await
evt
.
respond
(
f
'
{
self
.
markdown_link
(
number
)
}
comment added 🤓
{
self
.
take_this
}
'
)
await
self
.
_comment
(
number
,
'
comment
'
,
text
)
displayname
=
await
self
.
_displayname
(
evt
.
room_id
,
evt
.
sender
)
content
=
TextMessageEventContent
(
msgtype
=
MessageType
.
NOTICE
,
format
=
Format
.
HTML
,
body
=
f
'
{
displayname
}
commented 🤓 on
{
number
}
{
self
.
take_this
}
'
,
formatted_body
=
f
'
<a href=
"
https://matrix.to/#/
{
evt
.
sender
}
"
>
{
evt
.
sender
}
</a>
'
f
'
commented 🤓 on <code>
{
number
}
</code>
{
self
.
take_this
}
'
)
await
evt
.
respond
(
content
)
@rt.subcommand
(
'
reply
'
,
aliases
=
(
'
re
'
,
'
rep
'
),
help
=
'
Reply to requestor(s).
'
)
@command.argument
(
'
number
'
,
'
ticket number
'
,
parser
=
str
)
@command.argument
(
'
text
'
,
'
reply text
'
,
pass_raw
=
True
)
async
def
reply
(
self
,
evt
:
MessageEvent
,
number
:
str
,
text
:
str
)
->
None
:
if
not
self
.
can_manage
(
evt
)
or
not
self
.
valid_number
(
number
):
return
await
evt
.
mark_read
()
await
self
.
_comment
(
number
,
'
correspond
'
,
text
)
displayname
=
await
self
.
_displayname
(
evt
.
room_id
,
evt
.
sender
)
content
=
TextMessageEventContent
(
msgtype
=
MessageType
.
NOTICE
,
format
=
Format
.
HTML
,
body
=
f
'
{
displayname
}
replied 📨 to
{
number
}
{
self
.
take_this
}
'
,
formatted_body
=
f
'
<a href=
"
https://matrix.to/#/
{
evt
.
sender
}
"
>
{
evt
.
sender
}
</a>
'
f
'
replied 📨 to <code>
{
number
}
</code>
{
self
.
take_this
}
'
)
await
evt
.
respond
(
content
)
@rt.subcommand
(
'
history
'
,
aliases
=
(
'
h
'
,
'
hist
'
),
help
=
'
Get a list of all history entries.
'
)
@command.argument
(
'
number
'
,
'
ticket number
'
,
parser
=
str
)
...
...
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