diff --git a/data/mon_names/en.json b/data/mon_names/en.json index 6f0e6a9..5acbf9c 100644 --- a/data/mon_names/en.json +++ b/data/mon_names/en.json @@ -896,5 +896,132 @@ "895": "Regidrago", "896": "Glastrier", "897": "Spectrier", - "898": "Calyrex" + "898": "Calyrex", + "899": "Wyrdeer", + "900": "Kleavor", + "901": "Ursaluna", + "902": "Basculegion", + "903": "Sneasler", + "904": "Overqwil", + "905": "Enamorus", + "906": "Sprigatito", + "907": "Floragato", + "908": "Meowscarada", + "909": "Fuecoco", + "910": "Crocalor", + "911": "Skeledirge", + "912": "Quaxly", + "913": "Quaxwell", + "914": "Quaquaval", + "915": "Lechonk", + "916": "Oinkologne", + "917": "Tarountula", + "918": "Spidops", + "919": "Nymble", + "920": "Lokix", + "921": "Pawmi", + "922": "Pawmo", + "923": "Pawmot", + "924": "Tandemaus", + "925": "Maushold", + "926": "Fidough", + "927": "Dachsbun", + "928": "Smoliv", + "929": "Dolliv", + "930": "Arboliva", + "931": "Squawkabilly", + "932": "Nacli", + "933": "Naclstack", + "934": "Garganacl", + "935": "Charcadet", + "936": "Armarouge", + "937": "Ceruledge", + "938": "Tadbulb", + "939": "Bellibolt", + "940": "Wattrel", + "941": "Kilowattrel", + "942": "Maschiff", + "943": "Mabosstiff", + "944": "Shroodle", + "945": "Grafaiai", + "946": "Bramblin", + "947": "Brambleghast", + "948": "Toedscool", + "949": "Toedscruel", + "950": "Klawf", + "951": "Capsakid", + "952": "Scovillain", + "953": "Rellor", + "954": "Rabsca", + "955": "Flittle", + "956": "Espathra", + "957": "Tinkatink", + "958": "Tinkatuff", + "959": "Tinkaton", + "960": "Wiglett", + "961": "Wugtrio", + "962": "Bombirdier", + "963": "Finizen", + "964": "Palafin", + "965": "Varoom", + "966": "Revavroom", + "967": "Cyclizar", + "968": "Orthworm", + "969": "Glimmet", + "970": "Glimmora", + "971": "Greavard", + "972": "Houndstone", + "973": "Flamigo", + "974": "Cetoddle", + "975": "Cetitan", + "976": "Veluza", + "977": "Dondozo", + "978": "Tatsugiri", + "979": "Annihilape", + "980": "Clodsire", + "981": "Farigiraf", + "982": "Dudunsparce", + "983": "Kingambit", + "984": "Great Tusk", + "985": "Scream Tail", + "986": "Brute Bonnet", + "987": "Flutter Mane", + "988": "Slither Wing", + "989": "Sandy Shocks", + "990": "Iron Treads", + "991": "Iron Bundle", + "992": "Iron Hands", + "993": "Iron Jugulis", + "994": "Iron Moth", + "995": "Iron Thorns", + "996": "Frigibax", + "997": "Arctibax", + "998": "Baxcalibur", + "999": "Gimmighoul", + "1000": "Gholdengo", + "1001": "Wo-Chien", + "1002": "Chien-Pao", + "1003": "Ting-Lu", + "1004": "Chi-Yu", + "1005": "Roaring Moon", + "1006": "Iron Valiant", + "1007": "Koraidon", + "1008": "Miraidon", + "1009": "Walking Wake", + "1010": "Iron Leaves", + "1011": "Dipplin", + "1012": "Poltchageist", + "1013": "Sinistcha", + "1014": "Okidogi", + "1015": "Munkidori", + "1016": "Fezandipiti", + "1017": "Ogerpon", + "1018": "Archaludon", + "1019": "Hydrapple", + "1020": "Gouging Fire", + "1021": "Raging Bolt", + "1022": "Iron Boulder", + "1023": "Iron Crown", + "1024": "Terapagos", + "1025": "Pecharunt" } diff --git a/nests.json b/nests.json index f328d6d..8db3508 100644 --- a/nests.json +++ b/nests.json @@ -11,7 +11,7 @@ #if(nestjson != nil): #for(nest in nestjson): { - "url": "https://raw.githubusercontent.com/whitewillem/PogoAssets/resized/icons_large/pokemon_icon_#index(nest, 0)_00.png", + "url": "https://raw.githubusercontent.com/whitewillem/PogoAssets/main/uicons-outline/pokemon/#index(nest, 0).png", "latitude": #index(nest, 1), "longitude": #index(nest, 2), "width": 30, diff --git a/nests.py b/nests.py index 9e555c2..0e1ad90 100644 --- a/nests.py +++ b/nests.py @@ -47,13 +47,13 @@ def timestr_to_datetime(time): if event_start > local_time: continue event_end = timestr_to_datetime(event["end"]) - + if event_end <= last_migration: continue if (event_start <= last_migration) and (event_end > local_time): continue - + if event_end < local_time: last_migration = event_end log.info(f"Overwriting nest migration with the end time of {event['name']}") @@ -201,7 +201,10 @@ def timestr_to_datetime(time): if len(discord_message_data) > 0: log.info("Logging into Discord") - bot = discord.Client() + activity = discord.Activity(type=discord.ActivityType.watching, name="Nests Updating...") + intents = discord.Intents.default() + intents.message_content = True + bot = discord.Client(intents=intents, activity=activity, status=discord.Status.online) @bot.event async def on_ready(): @@ -244,7 +247,7 @@ async def on_ready(): emote_refs = None if config.discord_token: - bot = discord.Client() + bot = discord.Client(intents=intents, activity=activity, status=discord.Status.online) @bot.event async def on_ready(): bot.emote_refs = await get_emotes(bot, nesting_mons, config) @@ -279,9 +282,9 @@ async def on_ready(): for key in keys: if key in embed_dict.keys(): embed[key] = embed_dict[key] - + r = requests.post(webhook_link, json={"embeds": [embed]}) log.success(f"Sent Webhook for {area.name} ({r.status_code})") time.sleep(1) -log.success("All done.") \ No newline at end of file +log.success("All done.") diff --git a/nestwatcher/analyze.py b/nestwatcher/analyze.py index 60665f8..e2221eb 100644 --- a/nestwatcher/analyze.py +++ b/nestwatcher/analyze.py @@ -6,7 +6,7 @@ from rich.progress import Progress from shapely import geometry -from shapely.ops import polylabel, cascaded_union +from shapely.ops import polylabel, unary_union from shapely.errors import TopologicalError from geojson import Feature from collections import defaultdict @@ -21,7 +21,7 @@ def osm_date(): def analyze_nests(config, area, nest_mons, queries, reset_time, nodelete): OSM_DATE = osm_date() # Getting OSM/overpass data - + osm_file_name = f"data/osm_data/{area.name} {OSM_DATE.replace(':', '')}.json" try: with open(osm_file_name, mode="r", encoding="utf-8") as osm_file: @@ -49,7 +49,7 @@ def analyze_nests(config, area, nest_mons, queries, reset_time, nodelete): db_data = json.load(db_file) except FileNotFoundError: db_data = {}""" - + if not nodelete: queries.nest_delete(area.sql_fence, str(reset_time)) @@ -93,7 +93,7 @@ def analyze_nests(config, area, nest_mons, queries, reset_time, nodelete): all_spawns = [(str(_id), geometry.Point(lon, lat)) for _id, lat, lon in queries.spawns(area.sql_fence)] all_mons = queries.all_mons(str(tuple(nest_mons)), str(reset_time), area.sql_fence) all_mons = [(_id, geometry.Point(lon, lat)) for _id, lat, lon in all_mons] - + with Progress() as progress: #check_rels_task = progress.add_task("Generating Polygons", total=len(parks)) for park in relations: @@ -114,7 +114,7 @@ def analyze_nests(config, area, nest_mons, queries, reset_time, nodelete): small_park_i = i parks[big_park_i].connect.append(connect_id) - parks[big_park_i].polygon = cascaded_union([big_park.polygon, small_park.polygon]) + parks[big_park_i].polygon = unary_union([big_park.polygon, small_park.polygon]) parks.pop(small_park_i) # NOW CHECK ALL AREAS ONE AFTER ANOTHER @@ -251,4 +251,4 @@ def sort_avg(nest): log.info(f"Sent data to Poracle with status code {r.status_code}") log.success(f"All done with {area.name}\n") - return nests \ No newline at end of file + return nests diff --git a/nestwatcher/area.py b/nestwatcher/area.py index e74399f..dd017d1 100644 --- a/nestwatcher/area.py +++ b/nestwatcher/area.py @@ -144,7 +144,7 @@ def sort_name(nest): ) def add_to_points(points, monid, lat, lon): points.append([ - str(monid).zfill(3), + str(monid), round(lat, 6), round(lon, 6) ]) diff --git a/nestwatcher/discord.py b/nestwatcher/discord.py index bc75977..b1f497e 100644 --- a/nestwatcher/discord.py +++ b/nestwatcher/discord.py @@ -24,7 +24,7 @@ async def get_emotes(bot, nesting_mons, config): if emoji.name not in emote_names: log.info(f"Found emoji {emoji.name} not being used anymore - deleting") await emoji.delete() - + # emote creation final_emotes = {} for monid in nesting_mons: @@ -41,7 +41,7 @@ async def get_emotes(bot, nesting_mons, config): if not free_guild: try: - free_guild = await bot.create_guild("Nest Emotes") + free_guild = await bot.create_guild(name="Nest Emotes") channel = await free_guild.create_text_channel("hello") invite = await channel.create_invite() log.info(f"Created new emote server. Invite code: {invite.code}") @@ -51,11 +51,11 @@ async def get_emotes(bot, nesting_mons, config): log.exception(e) return final_emotes - image_url = config.icon_repo + f"pokemon_icon_{monid.zfill(3)}_00.png" + image_url = config.icon_repo + f"pokemon/{monid}.png" image = requests.get(image_url).content emoji = await free_guild.create_custom_emoji(name=emote_name, image=image) log.info(f"Created emoji {emote_name}") final_emotes[int(monid)] = emoji.id - + return final_emotes diff --git a/requirements.txt b/requirements.txt index 0af38b5..5de6d55 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,4 @@ pymysql geojson discord.py rich -coloredlogs \ No newline at end of file +coloredlogs diff --git a/tools.py b/tools.py index 3058105..7243b70 100644 --- a/tools.py +++ b/tools.py @@ -38,7 +38,10 @@ def list_options(tools): areaname = input("Area: ") print("Starting the bot now. Please write 'start' and follow your bot's instructions.") - bot = discord.Client() + activity = discord.Activity(type=discord.ActivityType.watching, name="Nests Updating...") + intents = discord.Intents.default() + intents.message_content = True + bot = discord.Client(intents=intents, activity=activity, status=discord.Status.online) @bot.event async def on_message(message): if not message.content == "start": @@ -369,13 +372,15 @@ def check(reaction, user): if confirm == "n": sys.exit() - bot = discord.Client() + activity = discord.Activity(type=discord.ActivityType.watching, name="Nests Updating...") + intents = discord.Intents.default() + intents.message_content = True + bot = discord.Client(intents=intents, activity=activity, status=discord.Status.online) @bot.event async def on_ready(): for guild in bot.guilds: if guild.name == "Nest Emotes": await guild.delete() - await bot.logout() bot.run(config.discord_token)