Dedicated logger for updates
This commit is contained in:
parent
e172346c3b
commit
8d1ecc030d
2 changed files with 4 additions and 7 deletions
|
@ -77,7 +77,7 @@ class BotutilCog(Scale):
|
||||||
|
|
||||||
@msg_command(name="update")
|
@msg_command(name="update")
|
||||||
async def _update(self, ctx: MessageContext) -> None:
|
async def _update(self, ctx: MessageContext) -> None:
|
||||||
status = await update(self.bot, self.logger)
|
status = await update(self.bot)
|
||||||
if status:
|
if status:
|
||||||
console = Console()
|
console = Console()
|
||||||
with console.capture() as capture:
|
with console.capture() as capture:
|
||||||
|
|
|
@ -17,10 +17,10 @@ from rich.table import Table
|
||||||
import jarvis.cogs
|
import jarvis.cogs
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from logging import Logger
|
|
||||||
|
|
||||||
from dis_snek.client.client import Snake
|
from dis_snek.client.client import Snake
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class UpdateResult:
|
class UpdateResult:
|
||||||
|
@ -105,19 +105,16 @@ def get_git_changes() -> dict:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async def update(bot: "Snake", logger: "Logger" = None) -> Optional[UpdateResult]:
|
async def update(bot: "Snake") -> Optional[UpdateResult]:
|
||||||
"""
|
"""
|
||||||
Update JARVIS and return an UpdateResult.
|
Update JARVIS and return an UpdateResult.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
bot: Bot instance
|
bot: Bot instance
|
||||||
logger: Logger instance
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
UpdateResult object
|
UpdateResult object
|
||||||
"""
|
"""
|
||||||
if not logger:
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
repo = git.Repo(".")
|
repo = git.Repo(".")
|
||||||
current_hash = repo.head.object.hexsha
|
current_hash = repo.head.object.hexsha
|
||||||
origin = repo.remotes.origin
|
origin = repo.remotes.origin
|
||||||
|
|
Loading…
Add table
Reference in a new issue