fix(core): close TUXBOT-BOT-Z
This commit is contained in:
parent
c566f775cd
commit
1e86abdf01
5 changed files with 19 additions and 5 deletions
4
Makefile
4
Makefile
|
@ -16,11 +16,11 @@ update:
|
||||||
update_soft:
|
update_soft:
|
||||||
$(VENV)/bin/pip install --upgrade .
|
$(VENV)/bin/pip install --upgrade .
|
||||||
|
|
||||||
dev: reformat update_soft
|
dev: black update_soft
|
||||||
tuxbot dev
|
tuxbot dev
|
||||||
|
|
||||||
# Blackify code
|
# Blackify code
|
||||||
reformat:
|
black:
|
||||||
$(PYTHON) -m black `git ls-files "*.py"` --line-length=79 && $(PYTHON) -m pylint tuxbot
|
$(PYTHON) -m black `git ls-files "*.py"` --line-length=79 && $(PYTHON) -m pylint tuxbot
|
||||||
|
|
||||||
# Translations
|
# Translations
|
||||||
|
|
|
@ -252,6 +252,10 @@ class Logs(commands.Cog, name="Logs"):
|
||||||
name="Content",
|
name="Content",
|
||||||
value=textwrap.shorten(ctx.message.content, width=512),
|
value=textwrap.shorten(ctx.message.content, width=512),
|
||||||
)
|
)
|
||||||
|
e.add_field(
|
||||||
|
name="Bot Instance",
|
||||||
|
value=self.bot.instance_name,
|
||||||
|
)
|
||||||
|
|
||||||
exc = "".join(
|
exc = "".join(
|
||||||
traceback.format_exception(
|
traceback.format_exception(
|
||||||
|
|
|
@ -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"}
|
output = {"belongs": "N/A", "rir": "N/A", "region": "N/A", "flag": "N/A"}
|
||||||
|
|
||||||
if ipinfo_result:
|
if ipinfo_result:
|
||||||
org = ipinfo_result.get("org", "")
|
org = ipinfo_result.get("org", "N/A")
|
||||||
asn = org.split()[0] if len(org.split()) > 1 else 'N/A'
|
asn = org.split()[0] if len(org.split()) > 1 else "N/A"
|
||||||
|
|
||||||
output["belongs"] = f"[{org}](https://bgp.he.net/{asn})"
|
output["belongs"] = f"[{org}](https://bgp.he.net/{asn})"
|
||||||
output["rir"] = f"```{ipwhois_result.get('asn_registry', 'N/A')}```"
|
output["rir"] = f"```{ipwhois_result.get('asn_registry', 'N/A')}```"
|
||||||
|
|
|
@ -91,6 +91,7 @@ class Tux(commands.AutoShardedBot):
|
||||||
self.max_messages = message_cache_size
|
self.max_messages = message_cache_size
|
||||||
|
|
||||||
self.uptime = None
|
self.uptime = None
|
||||||
|
self.last_on_ready = None
|
||||||
self._app_owners_fetched = False # to prevent abusive API calls
|
self._app_owners_fetched = False # to prevent abusive API calls
|
||||||
|
|
||||||
self.before_invoke(self._typing)
|
self.before_invoke(self._typing)
|
||||||
|
@ -145,7 +146,12 @@ class Tux(commands.AutoShardedBot):
|
||||||
progress.advance(task)
|
progress.advance(task)
|
||||||
|
|
||||||
async def on_ready(self):
|
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.uptime = datetime.datetime.now()
|
||||||
|
self.last_on_ready = self.uptime
|
||||||
app_config = ConfigFile(config_dir / "config.yaml", AppConfig).config
|
app_config = ConfigFile(config_dir / "config.yaml", AppConfig).config
|
||||||
set_for_key(
|
set_for_key(
|
||||||
app_config.Instances,
|
app_config.Instances,
|
||||||
|
|
|
@ -433,7 +433,11 @@ def basic_setup() -> None:
|
||||||
|
|
||||||
|
|
||||||
def update() -> 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:
|
if response.get("sha")[:6] == version_info.build:
|
||||||
print(
|
print(
|
||||||
|
|
Loading…
Reference in a new issue