|
22 | 22 | SOFTWARE.
|
23 | 23 | """
|
24 | 24 |
|
25 |
| -__version__ = '2.0.6' |
| 25 | +__version__ = '2.0.7' |
26 | 26 |
|
27 | 27 | import asyncio
|
28 | 28 | import textwrap
|
|
39 | 39 | from core.api import Github, ModmailApiClient
|
40 | 40 | from core.thread import ThreadManager
|
41 | 41 | from core.config import ConfigManager
|
| 42 | +from core.changelog import ChangeLog |
42 | 43 |
|
43 | 44 |
|
44 | 45 | init()
|
@@ -166,12 +167,13 @@ async def on_ready(self):
|
166 | 167 | {Fore.CYAN}Guild ID: {self.guild.id if self.guild else 0}
|
167 | 168 | {line}
|
168 | 169 | """).strip())
|
169 |
| - |
| 170 | + |
170 | 171 | if not self.guild:
|
171 | 172 | print(Fore.RED + Style.BRIGHT + 'WARNING - The GUILD_ID provided does not exist!' + Style.RESET_ALL)
|
172 | 173 | else:
|
173 | 174 | await self.threads.populate_cache()
|
174 | 175 |
|
| 176 | + |
175 | 177 | async def process_modmail(self, message):
|
176 | 178 | """Processes messages sent to the bot."""
|
177 | 179 |
|
@@ -393,28 +395,27 @@ async def autoupdate_loop(self):
|
393 | 395 | data = await self.modmail_api.update_repository()
|
394 | 396 |
|
395 | 397 |
|
396 |
| - em = discord.Embed(title='Updating bot', color=discord.Color.green()) |
| 398 | + em = discord.Embed(color=discord.Color.green()) |
397 | 399 |
|
398 | 400 | commit_data = data['data']
|
399 | 401 | user = data['user']
|
400 |
| - em.set_author(name=user['username'], icon_url=user['avatar_url'], url=user['url']) |
| 402 | + em.set_author(name=user['username'] + ' - Updating Bot', icon_url=user['avatar_url'], url=user['url']) |
401 | 403 | em.set_footer(text=f"Updating modmail v{self.version} -> v{metadata['latest_version']}")
|
402 | 404 |
|
| 405 | + changelog = await ChangeLog.from_repo(self) |
| 406 | + latest = changelog.latest_version |
| 407 | + em.description = latest.description |
| 408 | + for name, value in latest.fields.items(): |
| 409 | + em.add_field(name=name, value=value) |
| 410 | + |
403 | 411 | if commit_data:
|
404 |
| - em.description = 'Bot successfully updated, the bot will restart momentarily' |
405 | 412 | message = commit_data['commit']['message']
|
406 | 413 | html_url = commit_data["html_url"]
|
407 | 414 | short_sha = commit_data['sha'][:6]
|
408 | 415 | em.add_field(name='Merge Commit', value=f"[`{short_sha}`]({html_url}) {message} - {user['username']}")
|
409 | 416 | print('Updating bot.')
|
410 |
| - else: |
411 |
| - await asyncio.sleep(3600) |
412 |
| - continue |
413 |
| - |
414 |
| - em.add_field(name='Latest Commit', value=await self.get_latest_updates(limit=1), inline=False) |
415 |
| - |
416 |
| - channel = self.main_category.channels[0] |
417 |
| - await channel.send(embed=em) |
| 417 | + channel = self.main_category.channels[0] |
| 418 | + await channel.send(embed=em) |
418 | 419 |
|
419 | 420 | await asyncio.sleep(3600)
|
420 | 421 |
|
|
0 commit comments