5
5
from pydantic import BaseModel
6
6
7
7
8
- class ZammadGroups :
9
- billing = settings .ZAMMAD_GROUP_BILLING
10
- helpdesk = settings .ZAMMAD_GROUP_HELPDESK
11
-
8
+ class ZammadConfig :
9
+ url = settings .ZAMMAD_URL # servicedesk.europython.eu
10
+ billing_group = settings .ZAMMAD_GROUP_BILLING
11
+ helpdesk_group = settings . ZAMMAD_GROUP_HELPDESK
12
12
13
13
class ZammadGroup (BaseModel ):
14
14
id : int
@@ -92,19 +92,20 @@ def action(self):
92
92
# first message that originally creates the ticket. However first time
93
93
# we get a message, we will return "New ticket" and second time "New
94
94
# message in the thread".
95
- if self .article and len (self .ticket .article_ids ) == 1 :
96
- # This means we have an article, and it's a first one, therefore a
97
- # ticket is new.
98
- return self .Actions .new_ticket_created
95
+ if self .article :
96
+ if len (self .ticket .article_ids ) == 1 :
97
+ # This means we have an article, and it's a first one, therefore a
98
+ # ticket is new.
99
+ return self .Actions .new_ticket_created
99
100
100
- elif self . article and self .article .internal is True :
101
- return self .Actions .new_internal_note
101
+ elif self .article .internal is True :
102
+ return self .Actions .new_internal_note
102
103
103
- elif self . article and self .article .sender == "Customer" :
104
- return self .Actions .new_message_in_thread
104
+ elif self .article .sender == "Customer" :
105
+ return self .Actions .new_message_in_thread
105
106
106
- elif self . article and self .article .sender == "Agent" :
107
- return self .Actions .replied_in_thread
107
+ elif self .article .sender == "Agent" :
108
+ return self .Actions .replied_in_thread
108
109
109
110
elif not self .article :
110
111
return self .Actions .updated_ticket
@@ -121,7 +122,7 @@ def group(self):
121
122
122
123
@property
123
124
def url (self ):
124
- return f"https://servicedesk.europython.eu /#ticket/zoom/{ self .ticket .id } "
125
+ return f"https://{ ZammadConfig . url } /#ticket/zoom/{ self .ticket .id } "
125
126
126
127
def to_discord_message (self ):
127
128
message = "{group}: {sender} {action} {details}" .format
0 commit comments