fix(core): close TUXBOT-BOT-Z

This commit is contained in:
Romain J 2021-02-11 18:11:19 +01:00
parent c566f775cd
commit 1e86abdf01
5 changed files with 19 additions and 5 deletions

View file

@ -16,11 +16,11 @@ update:
update_soft:
$(VENV)/bin/pip install --upgrade .
dev: reformat update_soft
dev: black update_soft
tuxbot dev
# Blackify code
reformat:
black:
$(PYTHON) -m black `git ls-files "*.py"` --line-length=79 && $(PYTHON) -m pylint tuxbot
# Translations

View file

@ -252,6 +252,10 @@ class Logs(commands.Cog, name="Logs"):
name="Content",
value=textwrap.shorten(ctx.message.content, width=512),
)
e.add_field(
name="Bot Instance",
value=self.bot.instance_name,
)
exc = "".join(
traceback.format_exception(

View file

@ -72,8 +72,8 @@ def merge_ipinfo_ipwhois(ipinfo_result: dict, ipwhois_result: dict) -> dict:
output = {"belongs": "N/A", "rir": "N/A", "region": "N/A", "flag": "N/A"}
if ipinfo_result:
org = ipinfo_result.get("org", "")
asn = org.split()[0] if len(org.split()) > 1 else 'N/A'
org = ipinfo_result.get("org", "N/A")
asn = org.split()[0] if len(org.split()) > 1 else "N/A"
output["belongs"] = f"[{org}](https://bgp.he.net/{asn})"
output["rir"] = f"```{ipwhois_result.get('asn_registry', 'N/A')}```"

View file

@ -91,6 +91,7 @@ class Tux(commands.AutoShardedBot):
self.max_messages = message_cache_size
self.uptime = None
self.last_on_ready = None
self._app_owners_fetched = False # to prevent abusive API calls
self.before_invoke(self._typing)
@ -145,7 +146,12 @@ class Tux(commands.AutoShardedBot):
progress.advance(task)
async def on_ready(self):
if self.uptime is not None:
self.last_on_ready = datetime.datetime.now()
return
self.uptime = datetime.datetime.now()
self.last_on_ready = self.uptime
app_config = ConfigFile(config_dir / "config.yaml", AppConfig).config
set_for_key(
app_config.Instances,

View file

@ -433,7 +433,11 @@ def basic_setup() -> None:
def update() -> None:
response = json.load(request.urlopen("https://api.github.com/repos/Rom1-J/tuxbot-bot/commits/master"))
response = json.load(
request.urlopen(
"https://api.github.com/repos/Rom1-J/tuxbot-bot/commits/master"
)
) # skipcq: BAN-B310
if response.get("sha")[:6] == version_info.build:
print(