Giter Club home page Giter Club logo

pnavcopy's Introduction

IITC-Plugin: Copy PokeNav Command

Join the Discord server!

IITC Plugin that copies Portal Info to Clipboard or sends it directly to Discord via WebHook in the format needed by the PokeNav Discord Bot as follows:

@PokeNav create poi <type> ยซ<name>ยป <latitude> <longitude> "ex-eligible: 1" (if Ex Gym)

Prerequisites

To use this IITC Plugin, you need

  • An Account for Niantic's game Ingress
  • If you want to use your Computer (recommended), you need a Userscript Manager for your Browser (e.g. Tampermonkey) and a Version of IITC installed (IITC or IITC-CE). Alternatively you can use the Browser Addon "IITC Button" available for Chrome and Firefox.
  • If you want to use your Smartphone instead, you have to install IITC Mobile (Play Store, GitLab) or IITC CE Mobile (Play Store, GitHub) for Android. For IPhone you can only use IITC Mobile (not tested with this Plugin!) (App Store, GitHub).

Installation

To install the Plugin, click ๐Ÿ‘‰here๐Ÿ‘ˆ.

You should be asked if you want to install an external Plugin. Confirm the Installation and you are done!

Features

With This Plugin you can...

  • Classify a portal manually as Stop, Gym or EX Gym or use the Info already collected with Pogo Tools (see Integrations section)
  • Copy The Command to Clipboard, use a WebHook to send it directly to the appropriate Discord channel or use the Companion Bot
  • Decide if the commands should be sent directly to the Discord channel or a thread
  • Send all the Data already collected with PoGo Tools to PokeNav with a few Clicks
  • Pause the Bulk export and start off where you ended it
  • Check for modifications of Pogo Tools data automatically
  • Send or copy modification or deletion Commands for PokeNav, or let the Companion Bot do the work.
  • View your PokeNav community bounds as a circle on the map
  • Represent the state of the export in Colors with a highlighter: PokeStops are blue, Gyms red and Ex raid gyms have a red border and yellow filling.

Integrations

If you use the Pogo tools plugin by AlfonsoML (development from original author stalled, but still working), the info entered there is used to determine Type and Ex Eligibility if applicable. Otherwise you can choose manually.

If you use the Plugin, you also have the option to upload all gathered Data at once.

Original Source / Dependencies

Credits for the original source and licenses of dependencies can be found here.

Note

The Plugin is not the very best code style and the code may not be very "error-friendly" because i am in no way an expert in JavaScript at the moment, but the important thing for me was to get it work, and it does exacly that, nothing more ๐Ÿ˜‰

WebHook How-to:

A Tutorial on how to set up a WebHook in Discord can be found here.

The WebHook has to be set up for the PokeNav Admin Channel (named #pokenav by default).

If you created the WebHook, copy the WebHook URL and paste it into the Text Box in the Settings Dialog of the Userscript. The URL will be stored in Local Browser Storage for you, so you normally won't have to re-enter it.

Note: Have in mind that anyone who has the WebHook URL and knows how to post to WebHooks can send any Message he likes to the Channel, so be cautious who you give the WebHook URL to.

About the Companion Bot

The Companion Bot is a helper Bot that recieves a JSON file from the WebHook or an arbitrary CSV file from the user containing all PoI to create / update and posts the PokeNav commands one at a time. This is because WebHooks can only post 30 Messages per minute, resulting in long waiting times if you want to create all PoI via WebHook. And you have to keep IITC on all the time.

After the Export, the Bot does its Work automatically without the need to keep IITC open so long.

You can invite it to your server by clicking ๐Ÿ‘‰here๐Ÿ‘ˆ.

How to contribute?

You can contribute by...

  • translating this Plugin into your native language. A guide on how to translate can be found here.
  • contributing Code to the plugin or the bot. Please fork this repository and open a pull request. I will then take a look at it and if i consider it good, i'll merge it into the dev branch and later on into main if everything is working.
  • reporting Bugs and other issues.

pnavcopy's People

Contributors

maxetmoritz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pnavcopy's Issues

botEdit: TypeError: e is null

in the botEdit function, a strange Exception is thrown, i do not know what is causing it and how to avoid it. This is what JQuery logged to Console:

jQuery.Deferred exception: e is null parent@https://intel.ingress.com/ line 27321 > injectedScript:19037:26880
map@https://intel.ingress.com/ line 27321 > injectedScript:19037:3558
S.fn[r]@https://intel.ingress.com/ line 27321 > injectedScript:19037:27642
e@https://intel.ingress.com/ line 27321 > injectedScript:19037:30005
l/</t<@https://intel.ingress.com/ line 27321 > injectedScript:19037:30307
setTimeout handler*l/<@https://intel.ingress.com/ line 27321 > injectedScript:19037:30516
c@https://intel.ingress.com/ line 27321 > injectedScript:19037:28294
add@https://intel.ingress.com/ line 27321 > injectedScript:19037:28572
then/<@https://intel.ingress.com/ line 27321 > injectedScript:19037:30612
Deferred@https://intel.ingress.com/ line 27321 > injectedScript:19037:31025
then@https://intel.ingress.com/ line 27321 > injectedScript:19037:30541
S.fn.ready@https://intel.ingress.com/ line 27321 > injectedScript:19037:31831
S.fn.init@https://intel.ingress.com/ line 27321 > injectedScript:19037:25882
S@https://intel.ingress.com/ line 27321 > injectedScript:19037:1024
S.fn.init@https://intel.ingress.com/ line 27321 > injectedScript:19037:25516
S@https://intel.ingress.com/ line 27321 > injectedScript:19037:1024
work@https://intel.ingress.com/ line 1867 > injectedScript:1433:10
botEdit@https://intel.ingress.com/ line 1867 > injectedScript:1538:5
window.plugin.pnav.bulkModify@https://intel.ingress.com/ line 1867 > injectedScript:823:14
onclick@https://intel.ingress.com/:1:20
 undefined

and this is the error message thrown:

Uncaught TypeError: e is null
    parent https://intel.ingress.com/ line 27321 > injectedScript:19037
    map https://intel.ingress.com/ line 27321 > injectedScript:19037
    r https://intel.ingress.com/ line 27321 > injectedScript:19037
    e https://intel.ingress.com/ line 27321 > injectedScript:19037
    t https://intel.ingress.com/ line 27321 > injectedScript:19037
    setTimeout handler*l/< https://intel.ingress.com/ line 27321 > injectedScript:19037
    c https://intel.ingress.com/ line 27321 > injectedScript:19037
    add https://intel.ingress.com/ line 27321 > injectedScript:19037
    then https://intel.ingress.com/ line 27321 > injectedScript:19037
    Deferred https://intel.ingress.com/ line 27321 > injectedScript:19037
    then https://intel.ingress.com/ line 27321 > injectedScript:19037
    ready https://intel.ingress.com/ line 27321 > injectedScript:19037
    init https://intel.ingress.com/ line 27321 > injectedScript:19037
    S https://intel.ingress.com/ line 27321 > injectedScript:19037
    init https://intel.ingress.com/ line 27321 > injectedScript:19037
    S https://intel.ingress.com/ line 27321 > injectedScript:19037
    work https://intel.ingress.com/ line 1867 > injectedScript:1432
    botEdit https://intel.ingress.com/ line 1867 > injectedScript:1538
    bulkModify https://intel.ingress.com/ line 1867 > injectedScript:823
    onclick https://intel.ingress.com/:1
line 27321 > injectedScript:19037:26880
    parent https://intel.ingress.com/ line 27321 > injectedScript:19037
    map https://intel.ingress.com/ line 27321 > injectedScript:19037
    r https://intel.ingress.com/ line 27321 > injectedScript:19037
    e https://intel.ingress.com/ line 27321 > injectedScript:19037
    t https://intel.ingress.com/ line 27321 > injectedScript:19037
    (Async: setTimeout handler)
    l https://intel.ingress.com/ line 27321 > injectedScript:19037
    c https://intel.ingress.com/ line 27321 > injectedScript:19037
    add https://intel.ingress.com/ line 27321 > injectedScript:19037
    then https://intel.ingress.com/ line 27321 > injectedScript:19037
    Deferred https://intel.ingress.com/ line 27321 > injectedScript:19037
    then https://intel.ingress.com/ line 27321 > injectedScript:19037
    ready https://intel.ingress.com/ line 27321 > injectedScript:19037
    init https://intel.ingress.com/ line 27321 > injectedScript:19037
    S https://intel.ingress.com/ line 27321 > injectedScript:19037
    init https://intel.ingress.com/ line 27321 > injectedScript:19037
    S https://intel.ingress.com/ line 27321 > injectedScript:19037
    work https://intel.ingress.com/ line 1867 > injectedScript:1432
    botEdit https://intel.ingress.com/ line 1867 > injectedScript:1538
    bulkModify https://intel.ingress.com/ line 1867 > injectedScript:823
    onclick https://intel.ingress.com/:1

it seems like this is thrown at the end of executing the function, i get it twice per function call somehow...

Webhook URL Issue

This is a limited issue, because most people aren't using Discord Canary (although it probably also applies to PTB, but I haven't checked).

All the Canary urls, including webhooks, start with https://canary.discord.com/api/webhooks/, which is not accepted by the bot setup. To make it work, I had to download Discord stable to get an url that starts like this: https://discordapp.com/api/webhooks/.

You can probably just replace canary.discord with discordapp, as you would do with a link, but I've had the experience that it doesn't always work out quite as intended.

Better Code Style

"Code Style - What is that even?" make the code look like it is from one source and not like from 100 ๐Ÿคฃ

Try to integrate with Niantic Campfire

Now that Niantic Campfire is slowly being released to more and more players, it would be nice if it was possible to scrape Poi info from Campfire.
I don't have access yet and have to prepare for exams, but when the time comes, it's definitely worth looking into if it's possible.

Hoping that the web version of Campfire remains and isn't just an unwanted relic that Niantic will remove...

Automatically send the Command in Discord

This would be a very handy feature, but i am not sure how to do it atm.
An Idea is to create another userscript for the Discord Web Interface that fills in the Commands and sends them. But how can the two Scripts communicate with each other? Can it be achieved with Cookies?
Or is there another solution?
Or is there some url like discord://?message="xyz"?

Other Possibilities could be somehow creating a Bot or logging in with OAuth2, but that would for sure require servers or at least an URL ...

Edits: Display PoI Address

When there are multiple poi with the same name, you can have a hard time figuring out which one is the right one. PokeNav provides the Address directly, so why not use reverse Geocoding to figure out the Address? A free OSM service for this is documented here. This could also be a great idea for the bot, if PokeNav also uses Nominatim, a simple string comparison could maybe do the trick and simplify the code..

Bot: expecting 'pokestop' in edits file but getting 'stop'

I submit the creation POI types as 'pokestop' and 'gym', but in the edits json it is 'stop' and 'gym'. The Bot currently expects both to be 'pokestop' and 'gym' and thus states 'JSON parsing failed' when receiving an edits file.

This should probably be adapted in the script, to be more consistent.

Bot: Reacting only works with "Read Message History" permission

When a location needs to be edited and there are multiple matching locations, the Companion Bot needs to add a reaction like 1๏ธโƒฃ, 2๏ธโƒฃ, 3๏ธโƒฃ etc. to the PokeNav message. At the moment this somehow fails if the bot has no "message history" permission. It will recieve a HTTP 403 forbidden when adding a reaction, no matter if "add reactions" permission is granted or not.

i tried to add a reaction in a command module directly and this worked without problem, though i used the command context there.

is it just me doing stupid things or is this due to the way Discord defines "being active in a channel"? how to design the companion bot that it is considered "active" in the channel and is thus able to react without message history permission?

i want to lower the permissions to a bare minimum and this is currently the only place this would be needed. hopefully there is a workaround, but i don't know of one. if someone knows what is causing this or has a workaround for me, please let me know!

Thread Support

This is an Enhancement for both Bot and Script.

  • In the plugin itself, let the Webhook messages be sent to a thread by including a 'use thread' checkbox in settings.
    Limitation: As far as i can tell, Webhooks can post messages in threads, but they can't start threads. This means the user has to enter the Discord ID of an existing thread for this to work.

  • In the Companion Bot, using a thread to send the PokeNav commands should be a configurable option per server.
    Limitation: Discord.NET does not yet support threads. It is implemented but not yet released. Some things still need to be done until Discord.NET v3 with thread and interaction support is released. This is now released and the bot is updated.

2FA Issue?

I thought I had it set up correctly, but I'm getting the following error message:
"One or more errors occurred. (The server responded with error 60003: Two factor is required for this operation)"

I have 2FA enabled, so is it telling me I need to turn off 2FA to use the bot/webhook?

This is the output in my Pokenav channel:
220606141728

Also, I just want to say that even though it isn't working for me right now, it's a wonderful tool, and I thank you for taking the time to make it.

Bot: Switch from Discord.InteractivityAddon to Fergun.Interactive

Discord.InteractivityAddon by Playwo seems unsupported now, the GitHub Repo was deleted or set to private.
Fergun.Interactive is an actively maintained fork of that Package, adding more functionality and, most important, with update to Discord.Net 3.0.
I think this change is not that breaking, but just to not forget it, i'm writing it down.
https://www.nuget.org/packages/Fergun.Interactive
must happen before the bot part of #13 can happen.

edit bug

when editing, script tried to recreate edited stuff. dunno the details. needs investigation.

Improve UI

things are very ugly at the moment, would be cool to change that.

Request to try the companion bot

I saw in the documentation that

Note: The Companion Bot is still under construction and i don't know yet where to host it. If you want to try it, open an Issue. Eventually i will make it go Online then and share the Invite Link.

I'd be thrilled to help test this. This will make setting up new communities with PokeNav SO much easier.

Set Portal guid as PoI alias

PRO: This would make editing PoI much easier, especially for the Companion Bot, because you have a unique way of telling which PoI is meant. Currently, if a PoI should be updated (e.g one of the 100 Playground Pokestops should get a better name), you do not know for sure which of the PoI to modify exactly. If every PoI would have its portal guid as alias, it would be unique again.

CON: This rather cryptic alias may confuse community members who pull up Info for a PoI. Also, this is used very infrequently, because most of the time, the PoI stay the same.

What do others think about it? Please comment!

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.