Giter Club home page Giter Club logo

professor-pine's Introduction

Professor Pine Discord Bot

Official Discord server (setup help, support, feedback, etc.)

What you need

  • Discord account, 2x bot tokens
  • Node (v12+)
  • MySQL, create an empty schema to hold bot data
  • Native build system (to build zlib-sync)
    • npm install -g node-gyp
    • (if on Windows) npm install -g --production windows-build-tools

Copy data/private-settings.json.default to data/private-settings.json and fill it out:

{
  "discordBotToken": "<bot token for main bot>",
  "discordNotifyToken": "<bot token for DM / notification bot>",
  "owner": "<your Discord Snowflake ID>",
  "pokemonUrlBase": "<url for pokemon images>",
  "githubRepo": "<github repo to receieve gym change requests, in form user/repo, not full URL>",
  "githubUser": "<github user for creating gym change requests>",
  "githubPassword": "<github password for creating gym change requests>",
  "db": {
    "host": "<host for mysql db (localhost if running on same machine as bot)>",
    "port": "<mysql db port>",
    "user": "<mysql username>",
    "password: "<mysql password>",
    "schema": "<mysql schema name for pine's data>"
  }
}

Run npm install then npm start to start the bot.

professor-pine's People

Contributors

aallshouse avatar addisonbabcock avatar exileexo avatar forcedunknown avatar gobalopper avatar googer avatar itsasine avatar jeremy-dentel avatar mhasko avatar michaelstenborg avatar msten19 avatar timparenti avatar v3n avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

professor-pine's Issues

Create and support a new #raid-posts channel

It's bad UI to expect users to make discernments when your software already has the necessary data and can make the needed determinations. By defining regions, then expecting users to both know and observe those regions, you are reducing the usefulness of the software. Note: I'm not suggesting the removal of regions, they are helpful for categorization and hierarchy.

For example, some users won't have a clue which region they are in. Other users will not know what side of a boundary they are on if they are too close to it.

Create/use a generalized channel called something like #raid-posts (or even more obvious #raid-image-posts)

When processing the image, perform the lookup of the gym, determine the region, then place the channel in that region.

You can already match the gym name to the lookup table (or hopefully the database). Why make the user know the region when you already know it.

Just cancelling out is a bad approach.
https://github.com/Googer/Professor-Pine/blob/main-dev/app/process-image.js#L125

With a dedicated channel for all raid postings, you're reducing the barrier to entry for all users, both advanced and newbies. Heck, keep the region supported posting but also add support for the general channel. I can pretty much promise you will have more users posting into the general channel than the region specific one.

Is there a good reason not to use a general channel when you can lookup the data?

!start / !meet does not allow unsetting of the time

Was in a channel this morning and saw someone use !start 9:31 instead of !hatch 9:31 and asked how to unset the time (so it wasn't listed as meeting @ hatch time.

Looking through the code, doesn't seem to be a way to unset the time and using null (as the user suggested or asked if that would work) would likely cause it to say Meeting Time: Invalid Date since the input is passed into moment directly.

Add ambiguity clarification support to !meet command

The !meet command currently accepts both a time difference (!meet 10) and an absolute value (!meet 10:00am). This works for the majority of the time, except when a time difference can also mean an absolute (raid hatched at 9:30, and is available until 10:15), someone saying !meet 10 can mean meeting at 9:40am or 10am.

If both options are valid, !meet should prompt the user for clarification.

Using !here before !join messes up the !start command

Today one player arrived to a raid without signing up with !join beforehand, upon arriving he used !here and got added to the list of players being there, but not to the list of signed up players.

Trying to move forward the start-time after that with !start resulted in this error:

@EarthGoblins, An error occurred while running the command: TypeError: Cannot read property 'members' of undefined You shouldn't ever receive an error like this. Please contact EarthGoblin#4735.

The error have been reproduced and was not a one time occurrence.

Add weather to raid info

Add the ability to describe the weather for a raid so that Pine can further and more accurately show the type advantages for a raid.

  • Command to add weather to active raid
  • When weather is set, update type advantages
  • Update type advantages to all raids created for the next hour in the same S2 cell

JSON Feed for Raids

Creation of a page/endpoint that returns a JSON feed of current raid channels.

Data requested:

Name
lat
lng
star/egg/boss
Hatch Time
Expire Time
boss pokemon name or pokedex id no.

Nice to have:

Count of people interested
Count of people coming
Count of people here
Count of people done
Ability to Query Individual Raid for updated data

Background

I have wanted to integrate raid data into my research app, Pitt PokeResearch. I built the framework for displaying raids and keeping local data, but my ability to create this feature in Professor Pine has been limited. As previously discussed, all raids displayed this way would feature a link back to access the Discord Channel directly for coordination, etc,. The map is used for a quick visual indicator of what active channeled raids are available, but the goal is to get users over to Discord.

The other part of this would be providing custom research feeds for the PGP Discord to display as well. As users report research within the app, the data could be fed into channels in a way designed and approved by whoever is makes decisions for PGP.

Another limitation was having the app fully launched, but as of late January, it is now fully available in both APP stores

Raid Sample: https://i.imgur.com/dGYF4sB.gifv

Live Research JSON (2.1 Mile Radius): https://eggs.15656.com/poke-research/pgp-r.php
Live Pokestop Data JSON (2.1 Mile Radius): https://eggs.15656.com/poke-research/pgp.php

Links to Download App

Migrate private_settings.conf to a DB table

Migrate Pine's settings to a MySQL table. This effort should also allow for either:
A) A command to have pine refresh the settings in the DB.
B) Check the settings where appropriate on each command execution that references those settings.

Add "minimal" view setting

For the region raid channels it would be nice to have the raid posts summaries be more compact. I'm not sure how well this would go over so having it as a setting might be a better way to approach it.

Here is a quick example of what a "compact" view could look like:

Level 5 Raid against Giratina at Gym Name
Available: 5:00 PM - 5:45 PM
Group A: 5 trainers
Group B: 3 trainers (meet 5:15 PM)

Some type of daily quest reporting / notifications

Could be something as simple as !quest String of text describing the quest which then gets curated and users can request to see the current quest list for a region. (I don't think we want to have to maintain a list of pokestop locations or active potential quests since they change pretty frequently.)

Add command to mark players bringing a switch & let’s go

To help those with getting Melmetal, some players with Let’s Go have been bringing their copies to raids and allowing people to transfer Pokemon for boxes.

It has been brought up to have a !switch or !letsgo command to mark that someone is bringing their switch to the raid for quick reference of who is available to help with mystery boxes.

!nest command

Looking to get a !nest command that will link TSR's nest atlas. Probably pretty similar to the !map command. So we don't get a ton of requests like this, it might be best practice to allow Pine to just generate copy-paste commands on the fly. One command to set up the ! keyword and reply, another to remove those.

No 'tier' Pokemon are not being added to DB by populate-raid-bosses

When running !populate-raid-bosses currently only Pokemon with a tier assigned are being added to the DB.

This is because here:

pokemonMetadata.forEach(pokemon => {
if (pokemon.backupExclusive) {
names.push(pokemon.name || 'ex');
promises.push(Pokemon.addRaidBoss(pokemon.name || 'ex', 'ex', pokemon.shiny || pokemon.backupShiny, pokemon.nickname || pokemon.backupNickname));
} else if (pokemon.backupTier) {
names.push(pokemon.name || pokemon.backupTier + '');
promises.push(Pokemon.addRaidBoss(pokemon.name || pokemon.backupTier + '', pokemon.backupTier + '', pokemon.shiny || pokemon.backupShiny, pokemon.nickname || pokemon.backupNickname));
}
});

It is only checking for Pokemon that have a tier assigned - there is no further else to catch the other ones (perfect, etc).

I added an else and purely pushed the name and this populated the database as expected. The new entries for spawns, some have nicknames and some don't so I'm not sure how you want to handle that.

OCR Inaccuracies

Looking to improve the OCR raid detection in Pine. We believe more users are using this and thus the inaccuracies are increasing.

Ask clarification when 2 gyms of same name are found in a region.

In light of the information about duplicates, here it what I would suggest.

The gyms.json contains ancillary information due to the geocoding. If a gym is found to have duplicate names when posted within a general channel, then provide the user with feedback and options.

Here's a possible response stream of messages.

Msg1: Hey, I found 3 gyms with Shiny Deals at Sprint! Give me a thumbs up on the one you think you're at.
Msg2: Find Shiny Deals by McDonalds at [Street name] #region-x
Msg3: Find Shiny Deals by Another Biz on [Street name] #region-y
Msg4: Find Shiny Deals on [Street name] #region-z

When the user adds a reaction, you then know the location of the gym. This would both serve the purpose to make adding images more streamlined and easier and also educate the user with regards to which region they are operating in. Even in a small area like mine, regions are valuable because many people don't want to drive a full 45 min to get to a gym. By scanning only for raids within a smaller region, they get more value. Yet many users will never learn which region a gym is in. Given that situation, they will be frustrated by not posting the right image in the right region and the immediate fail - and this will absolutely decrease the incentive to use the bot. It requires too much thinking on behalf of the user when software can solve the problem.

Can Pine see user reactions to messages and take an appropriate action? I would think that's probably within the discord code.

Just an idea.

Originally posted by @digumo in #10 (comment)

Add !form command

With the introduction of Kanto Raichu into raids as well as Alolan Raichu at the same time, a generic !form <kanto | alolan> to quickly switch between the forms for raid bosses.

Add !auto invisible option

This would allow reporting of raids without showing to other server members the user who reported it. Useful for those paranoid users who don't want people knowing where they are.

The admin could still see the user by viewing the server logs. This might require adding the username, if that is possible, to the logs? I seem to remember it only storing the Discord user ID currently.

New option for original poster of raid image to not be interested by default

In our community we have a large number of people who post raid screenshots with the associated phrase of "Just posting". This means they are letting people know about the raid but cannot attend themselves. Our area is more suburban and many people may be interested in a raid if they know about it but it may only be within visual range of a few people.

Suggest adding two settings.

  1. a global option within settings.json
"users" : {
  "original_poster_isInterested": false,
}

or this could be included within "features"?

  1. an individual user preference stored within the database which could be controlled by a command such as !interestedWhenPosting false

Images not loading for Pokemon with ID less than 100

I discovered this by having an Alakazam raid nearby as my first test and found that a lot of Gen 1 Pokemon were not having their image loaded.

In the url call the poke.number is not zero padded so the url link won't work, as the poke.number is just an integer value.

if (poke.number && poke.tier) {
poke.bossCP = Pokemon.calculateBossCP(poke);
poke.minBaseCP = Pokemon.calculateCP(poke, 20, 10, 10, 10);
poke.maxBaseCP = Pokemon.calculateCP(poke, 20, 15, 15, 15);
poke.minBoostedCP = Pokemon.calculateCP(poke, 25, 10, 10, 10);
poke.maxBoostedCP = Pokemon.calculateCP(poke, 25, 15, 15, 15);
poke.url = `${privateSettings.pokemonUrlBase}pokemon_icon_${poke.number}_${formId}.png`
}

I tested putting some crude zero padding in my version and the images then worked as expected.

Leave the raid screenshot when the gym name match isn't great

We've had a few instances where raids have been reported and the person who uploaded the image didn't verify that the gym name matched properly. This has resulted in some people driving and finding no raid at the gym.

Would it be possible to have the raid channel show the screenshot, like it does when it can't get an accurate hatch or raid boss, for cases where it doesn't match all the words of a gym?

For example, the screenshot that was uploaded was for "Ball Lake Wetlands Info Sign" but the bot created a channel for "Broadmoor Lake Park Sign". Looking at the logs the text it found was "3i Lake". Granted I could create nickname for "3i Lake" but taking that approach means I need to check the logs every time there is a report.

Another option could be a setting where the bot always leaves the screenshot in the channel and then there is a new command, maybe something like "!verify", where a user can confirm the screenshot was mapped properly.

Thoughts?

Add a gym search functionality

Allow the users to query the gym database from Discord, displaying gym names and what region they are located in, plus the ability to quickly map the gym in question (!where but outside of the raid channel).

Could potentially see issues when there are many generic gym names like 'Starbucks' in relaying that to the user without filling the whole screen (DM maybe).

But some form of the above would be useful.

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.