leaguefacts

This commit is contained in:
xeals 2023-04-08 16:53:23 +10:00
parent 73a31d7b99
commit fd4ac1d544
Signed by: xeals
GPG Key ID: A498C7AF27EC6B5C
2 changed files with 34 additions and 10 deletions

23
bot.py
View File

@ -5,13 +5,14 @@ from typing import Optional
import argparse import argparse
import discord import discord
import logging import logging
import os.path
import random import random
import re import re
import shutil import shutil
import subprocess as sp import subprocess as sp
discord.utils.setup_logging() discord.utils.setup_logging()
_log = logging.getLogger("statbot") _log = logging.getLogger(__name__)
_GAMES = "games.txt" _GAMES = "games.txt"
_DB = "holy-heck2.db" _DB = "holy-heck2.db"
@ -43,11 +44,10 @@ def _update_db():
class BotClient(discord.Client): class BotClient(discord.Client):
def __init__( def __init__(
self, self,
intents: discord.Intents,
leaguefacts: Optional[list[str]] = None, leaguefacts: Optional[list[str]] = None,
intents: discord.Intents = discord.Intents.default(),
**options,
): ):
super(discord.Client, self).__init__(intents, options) super().__init__(intents=intents)
self._leaguefacts = leaguefacts or [] self._leaguefacts = leaguefacts or []
async def on_ready(self): async def on_ready(self):
@ -60,7 +60,7 @@ class BotClient(discord.Client):
elif self.is_leaguefact(message): elif self.is_leaguefact(message):
await self.on_leaguefact(message) await self.on_leaguefact(message)
async def is_replay(self, message: discord.Message) -> bool: def is_replay(self, message: discord.Message) -> bool:
if re.match("https://replay.pokemonshowdown.com/dl-.*", message.content): if re.match("https://replay.pokemonshowdown.com/dl-.*", message.content):
return True return True
return False return False
@ -70,13 +70,15 @@ class BotClient(discord.Client):
_write_game(message.content) _write_game(message.content)
_update_db() _update_db()
async def is_leaguefact(self, message: discord.Message) -> bool: def is_leaguefact(self, message: discord.Message) -> bool:
return message.content.lower() == "notleaguefact" return message.content.lower() == "notleaguefact"
async def on_leaguefact(self, message: discord.Message): async def on_leaguefact(self, message: discord.Message):
fact = self._select_leaguefact() fact = self._select_leaguefact()
if fact: if fact:
message.channel.send(fact) await message.channel.send(f"Did you know? {fact}")
else:
await message.channel.send("There are no league facts.")
def _select_leaguefact(self) -> Optional[str]: def _select_leaguefact(self) -> Optional[str]:
if not self._leaguefacts: if not self._leaguefacts:
@ -105,9 +107,10 @@ def main():
args = parser.parse_args() args = parser.parse_args()
facts = [] facts = []
with open(args.facts) as f: if os.path.exists(args.facts):
for line in f: with open(args.facts) as f:
facts.append(line) for line in f:
facts.append(line)
intents = discord.Intents.default() intents = discord.Intents.default()
intents.message_content = True intents.message_content = True

21
facts.txt Normal file
View File

@ -0,0 +1,21 @@
The Canberra Mamoswines have fielded the most unique Pokémon, with 13.
The Raleigh County Revavrooms have drafted the most unique Pokémon, with 18.
Barrow's Biggest Birds have made the most free agency exchanges so far, with 2 exchanges totalling 6 members.
Despite their name, Barrow's Biggest Birds do not currently possess any of largest birds in the league, and have only had at most three birds on their roster. They briefly had the tallest drafted bird, Quaquaval, but exchanged them in week 3.
The Raleigh County Revavrooms conducted the single largest free agency exchange in week 3, replacing eight members of their roster.
The Canberra Mamoswines are the slowest team, with an average of 64.5 Speed across their roster. The Raleigh County Revavrooms are the fastest, with an average of 83.3 Speed.
The Nimbasa City Ninjasks have the greatest Speed differential between their fastest and slowest members, of 112 points. Emily's Eevees and the Raleigh County Revavrooms are tied for the lowest differential, of 72 points.
The Buenos Aires Aggrons have largest roster, with 14 heads across their 10 members. However, the Raleigh County Revavrooms have the most bodies, with up to 13.
Emily's Eevees have the fewest limbs in the league, with only 24. Only two of their members are in the Amporphous egg group.
The Nimbasa City Ninjasks and the Canberra Mamoswines are tied for the most toxic rosters, with 2 Pokémon each capable of learning the move.
Cerluedge has more kills than all other Fire-type Pokémon combined that aren't some kind of Volcarona, as befitting of its ability, Flash Fire.
Landorus is the only Force of Nature that has not been drafted in season 3.
Emily's Eevees is the only roster to not have a Pokémon with more than 100 Speed.
Most teams have an average member cost of 12 points. Emily's Eevees and the Nimbasa City Ninjasks are tied for the most unevenly weighted teams, with a standard distribution of 6.87 points. The Raleigh County Revavrooms are the most evenly weighted, with a standard distribution of 5.29 points.
Only one team does not have a regional or alternate variant of a Pokémon on their roster: the Nimbasa City Ninjasks.
The East Midland Milotics have the fattest roster, claiming both Dondozo and Bellibolt.
Three teams have more than one 2-cost Pokémon in their rosters: Barrow's Biggest Birds, Mew York, and the Nimbasa City Ninjasks, each with 2 members. Five teams have no 2-cost Pokémon at all.
The San Francisco 549ers have the smallest Paldean representation in the league, with only one team member.
Moltres is the only legendary bird that has not been drafted in season 3.
Tyranitar, Metagross, and Kommo-o are the only pseudo-legendary Pokémon to not be drafted (either directly or as a variant) in season 3. Of these, only Metagross and Kommo-o are not available to be drafted.
Frosmoth is the biggest underdog in season 3 so far, having 4 knockouts to its name while only being a 2-point Pokémon.