Code Monkey home page Code Monkey logo

nestwatcher's Introduction

Nest Watcher

A Program to analyze nests in your area, save it to a database and send Discord notifications about them.

Links

  • Discord for help and keeping up with changes
  • Wiki to get everything running

nestwatcher's People

Contributors

ccev avatar clburlison avatar kneckter avatar krzee avatar lecnets avatar m4d40 avatar mag3sticl avatar marcb1387 avatar pizzamann113 avatar pjorritsma avatar reuschelcgn avatar snowbie1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nestwatcher's Issues

cannot convert string to float

When I try to use the discord bot portion to rename a park with a ' in the name the following error occurs:

Ignoring exception in on_message
Traceback (most recent call last):
File "/var/local/nestwatcher/ENV/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "tools.py", line 176, in on_message
points = [float(p.strip()) for p in points]
File "tools.py", line 176, in
points = [float(p.strip()) for p in points]
ValueError: could not convert string to float: "Nor'west Optimist Park"

Poracle Webhooks

Add an option to send webhooks to a Poracle (or similiar tools)

Event loop is closed

When running nests.py with a mix of discord channel ID and webhooks in the settings.json. The discord bot posts fine but then this message pops up when it attempts to send the webhooks.

/home/swks/.local/lib/python3.8/site-packages/discord/client.py:343: DeprecationWarning: logout is deprecated, use Client.close instead.
  await coro(*args, **kwargs)
/home/swks/.local/lib/python3.8/site-packages/discord/client.py:66: DeprecationWarning: Task.all_tasks() is deprecated, use asyncio.all_tasks() instead
  tasks = {t for t in task_retriever(loop=loop) if not t.done()}
Sending webhooks
Traceback (most recent call last):
  File "nests.py", line 253, in <module>
    bot.run(config.discord_token)
  File "/home/swks/.local/lib/python3.8/site-packages/discord/client.py", line 695, in run
    loop.add_signal_handler(signal.SIGINT, lambda: loop.stop())
  File "/usr/lib/python3.8/asyncio/unix_events.py", line 89, in add_signal_handler
    self._check_closed()
  File "/usr/lib/python3.8/asyncio/base_events.py", line 508, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

Add Nest Report for Telegram

Hi,

It would be nice if a nest report function could be added for Telegram. The concept is very similar to Discord. There are bots with associated tokens that could write the message in a group with a specific ID.

Thanks!

-t or --hours Argument Not Working As Intended

Hi There,

When using the -t or --hours Command line argument, it defaults to 3 hours no matter the number you put in.

  python3 nests.py --hours 7
  Last migration: 2022-07-21 02:00:00
  Overwriting hours since change with 3

  python3 nests.py --hours 5
  Last migration: 2022-07-21 02:00:00
  Overwriting hours since change with 3

Nest Migration Outdated

Hi there,

The "last nest migration" date is incorrect.

    Last migration: 2022-07-21 02:00:00
    Found no Event spawns since last migration
    Got all nesting species

next_migration dts not working

when running the script the next_migration dts is not working.

config.ini time_format = %%m-%%d %%l:%%M

discord.json "title": "Nest Report For {areaname}, Next Migration: {next_migration}"

when i run the report it just gives me
Nest Report For Mrc, Next Migration: %m-%d %l:%M

Event Check Fallback

With the most recent event not being updated to the active.json would it possible to return event_mons to the wiki, and leave it commented in the config.ini example?

To make it useful, maybe store the last event captured from active.json since nests.py was last run or maybe nests.py check another json url that stores that, to check against the current event found in active.json at the time it's ran. If it's the same, fallback to using the array found in event_mons.

Idk how feasible this is, just a thought, if it's a bad idea, np.

Missing Tags

These lines need to be added for a more complete nest detection

way["leisure"="nature_reserve"];
rel["leisure"="nature_reserve"];

Save Nests in database to edit unknown names for future re-use

Great work on this script, love using it!

I was wondering if there would be a way to have the script simply save all detected nests in the database and allow us then to manually edit those names which it is missing and later only update the pokemon field for use? having it check the database for the name before posting to discord?

tools.py option 3 not actually updating area_data json files

When I run tools.py and choose option 3 to update some nest names for an area. It prompts for the y/n for areas that have a name change but when I tell it y it doesn't seem to actually update that areas json file in the area_data folder. It also doesn't throw an error or anything it just acts like it ran it fine after I answer the y/n.

Docker-compose

It would be great if there is a docker-compose file.
So we can create a container for nestwatcher.

Only Send Webhooks when nest is being updated

At the moment, webhooks are being sent for the whole area as soon as only 1 nest from this area gets updated. This means the receiver (PoracleJS) would need to keep a cache of what was already received so it doesn't send double notifications.

Could you please change this behaviour so that webhooks are only sent when a nest is actually updated. This would make the development on the receiver side a lot easier.

Thanks

Creating emojis stuck

Just updated to latest version after getting problems with emoji.
I ran the tools.py and deleted the old emoji server.

ran the nests.py.
All went well, when it wanted to make a new server it got stuck

Created emoji m111
Created emoji m315
Created emoji m273
Created emoji m161
Created emoji m451
Created emoji m79
Created emoji m459
Created emoji m325
Created emoji m7
Created emoji m396
Created emoji m185
Created emoji m283
Created emoji m328
Created emoji m535
Created emoji m100
Created emoji m194
Created emoji m265
Created emoji m339
Created emoji m10
Created emoji m165
Created emoji m370
Created emoji m258
Created emoji m77
Created emoji m191
Created emoji m114
Created emoji m255
Created emoji m252

and then nothing happens, the server is created went to it the bot is there.
but nothing gets posted later on.

in the end i stopped everything

Traceback (most recent call last):
File "nests.py", line 211, in on_ready
emote_refs = await get_emotes(bot, nesting_mons, config)
File "/home/job-bais/nestwatcher/nestwatcher/discord.py", line 56, in get_emotes
emoji = await free_guild.create_custom_emoji(name=emote_name, image=image)
File "/home/job-bais/venv/lib/python3.6/site-packages/discord/guild.py", line 1664, in create_custom_emoji
data = await self._state.http.create_custom_emoji(self.id, name, img, roles=roles, reason=reason)
File "/home/job-bais/venv/lib/python3.6/site-packages/discord/http.py", line 178, in request
await lock.acquire()
File "/usr/lib/python3.6/asyncio/locks.py", line 181, in acquire
yield from fut
concurrent.futures._base.CancelledError

error when all nests fall below min_avg

python3 nests.py --nodelete --area Portimao --hours 8
Overwriting nest migration with the start time of Spring into Spring
Last migration: 2021-04-04 10:00:00
Overwriting hours since change with 3
Found active event since last migration: Buneary Spotlight Hour
Found active event since last migration: Spring into Spring
Got all nesting species
Establishing DB connection
Found area data file. Reading and using data from it now
Got all relevant information. Searching for nests in Portimao now
Getting DB data
Nests found: 3 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
Done finding nests in Portimao (1.3 seconds)

  • Total Nests found: 4
  • Not enough Spawnpoints: 9
  • No Stops or Spawnpoints: 35
  • Not enough Pokemon: 3
  • Not in Geofence: 34
  • Avoiding double nests: 2
    Saved area data
    All done with Portimao

Saved Geojson file
Sending webhooks
Traceback (most recent call last):
File "nests.py", line 266, in
if text not in entries:
NameError: name 'text' is not defined

Maptiles not posting

recent after 5/12 im not having any map tiles display. working for months before and not other issues with other programs that use my tile server.

Poracle recent had a similar issues but it needed to be adjusted to upload the tile first.

Not sure if something changed on discord side with this.

Feature Request: API timeout - split the area in smaller ones

At the moment the overpass querry fails if the area is to big.
If you split it manually you will get different webhooks for each area.

Could the script split the area in smaller ones, querry the api and at the end use the data again as one big area?

Timestamp Suggestion

{current_time} puts "Today at x:xx PM" in the embed which remains that way whether "Today" was yesterday or days ago. . Can this be changed to the full date? i.e. "Thursday, January 15th x:xx pm"

Un-tie Analyzer and Discord poster

Now that everything is stored in the database, those 2 things could even go into 2 seperate scripts.
Also add an option to update messages for each finished area, instead of doing them all at once in the end.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.