@@ -59,6 +59,10 @@ def parse(self) -> None:
59
59
else :
60
60
self .fields [curr_action ] += line + '\n '
61
61
62
+ @property
63
+ def url (self ) -> str :
64
+ return Changelog .CHANGELOG_URL + '#v' + self .version .replace ('.' , '' )
65
+
62
66
@property
63
67
def embed (self ) -> Embed :
64
68
"""
@@ -68,6 +72,7 @@ def embed(self) -> Embed:
68
72
embed .set_author (
69
73
name = f'v{ self .version } - Changelog' ,
70
74
icon_url = self .bot .user .avatar_url ,
75
+ url = self .url
71
76
)
72
77
73
78
for name , value in self .fields .items ():
@@ -99,14 +104,16 @@ class Changelog:
99
104
100
105
Class Attributes
101
106
----------------
102
- CHANGELOG_URL : str
107
+ RAW_CHANGELOG_URL : str
103
108
The URL to Modmail changelog.
104
109
VERSION_REGEX : re.Pattern
105
110
The regex used to parse the versions.
106
111
"""
112
+
113
+
107
114
108
- CHANGELOG_URL = ( 'https://raw.githubusercontent.com/'
109
- ' kyb3r/modmail/master/CHANGELOG.md')
115
+ RAW_CHANGELOG_URL = 'https://raw.githubusercontent.com/kyb3r/modmail/master/CHANGELOG.md '
116
+ CHANGELOG_URL = 'https://github.com/ kyb3r/modmail/blob/ master/CHANGELOG.md'
110
117
VERSION_REGEX = re .compile (r'# (v\d+\.\d+\.\d+)([\S\s]*?(?=# v|$))' )
111
118
112
119
def __init__ (self , bot : Bot , text : str ):
@@ -139,14 +146,14 @@ async def from_url(cls, bot: Bot, url: str = '') -> 'Changelog':
139
146
bot : Bot
140
147
The Modmail bot.
141
148
url : str, optional
142
- Defaults to `CHANGELOG_URL `.
149
+ Defaults to `RAW_CHANGELOG_URL `.
143
150
The URL to the changelog.
144
151
145
152
Returns
146
153
-------
147
154
Changelog
148
155
The newly created `Changelog` parsed from the `url`.
149
156
"""
150
- url = url or cls .CHANGELOG_URL
157
+ url = url or cls .RAW_CHANGELOG_URL
151
158
resp = await bot .session .get (url )
152
159
return cls (bot , await resp .text ())
0 commit comments