Coder Social home page Coder Social logo

professor-redwood-team / professor-redwood Goto Github PK

View Code? Open in Web Editor NEW
34.0 9.0 21.0 614 KB

Pokemon Go Discord Bot

License: MIT License

JavaScript 99.69% Makefile 0.19% Shell 0.12%
discord discordbot professor-redwood pokemon pokemongo bot raids

professor-redwood's Introduction

Professor Redwood

Build Status

Summary

Professor Redwood has arrived from the California Bay Area. He will help you run your local discord communities for Pokemon GO. See our bot in action on the SF PoGo Raids Meetup https://discord.gg/7tbySPV

How do I contribute?

Make a pull request!

How do I get set up?

To run this bot you will need a ES6 node environment. The bot currently does not have database functions.

  1. Create a role called mod and give it the following privileges:
  • Display role members separately from online members
  • Manage Roles
  • Check all boxes under Text Permissions
  1. Create roles (this will take a while):
  • currently roles must be completely lowercase or youre going to have a bad time see #22
  • valor, instinct, and mystic: all with at least: Display role members seperately, Read & Send Messages (recommend unchecking Mention Everyone), and color each team appropriately
  • create one role for each region that you plan to use. Regions consist of multiple channels. Channels consist of multiple neighborhoods. Examples in SF are: sf, peninsula, sanjose, eastbay
  • create a role named 'allregions'
  • create a role for each pokemon/quest reward specified in want.js, 'highiv', 'legendary', 'finalevo', 'shinycheck', 'shadow', 'exgym'. **All of these roles must have the 'allow anyone to @mention this role'
  1. Create Channels:
  • professor_redwood (a channel specifically for bot commands) - @everyone may Read & Send messages
  • missing_dex (required for Wild report alert forwarding) - only admin/mod should have Send Message privilege, everyone else should have read only privilege
  • gymraids_alerts (required for egg/raid alert forwarding) - only admin/mod should have Send Message privilege, everyone ele should have read only privilege
  • gymraids_+ the name of your region role - Alert forwarding specific to reports from the neighborhoods in a region
  • tr_alerts (required for Team Rocket alert forwarding) - only admin/mod/3 teams should have Send Message privilege, @everyone should have no privilege
  • tr_alerts__+ the name of your region role - Alert forwarding specific to reports from the neighborhoods in a region
  • quests_alerts (required for quest alert forwarding) - only admin/mod/3 teams should have Send Message privilege, @everyone should have no privilege
  • quests_+ the name of your region role - Alert forwarding specific to reports from the neighborhoods in a region
  • adventure_rules - Server rules page - only admin/mod roles should have Send Message privilege, @everyone should have Read only
  • bot_commands - List of all bot commands - only admin/mod roles should have Send Message privilege, @everyone should have Read only
  • neighborhood channels! When creating these, make sure to use '-' in each name, even if it's at the beginning or end. Proper examples are pier39-marina and sanjose- --> NOTE: make sure to only allow allregions and the appropriate region role to access each channel
  1. Follow instructions in the config/README.md to create an .env file with secrets in the root directory.

  2. Create your bot

  • Go to your discord developers page: https://discordapp.com/developers/applications/me
  • Click New App
  • Under App Name, type 'Professor Redwood', or another name for your bot
  • Click Create App
  • Click Create a Bot User
  • Under App Details, click to reveal the client secret, and paste it into your .env file under DISCORD_TOKEN
  • Paste the CLIENT ID in .env as well.
  • Now, copy the Client ID and paste it into this URL: https://discordapp.com/oauth2/authorize?scope=bot&permissions=1342401618&client_id=<CLIENT ID>
  • Choose the name of your Discord server
  • Authorize the Bot!
  • Go to the Server Settings for your discord, and search for a user/member, find your bot and grant it mod privileges
  1. Run your bot with either node bot.js or node server.js

professor-redwood's People

Contributors

awilbur avatar cub01d avatar dependabot[bot] avatar fmoo avatar jeffleu avatar jimleeisme avatar mar-cymk avatar mralanlee avatar pbk01 avatar pjlangsam avatar sparklerfish avatar stefangimmillaro avatar zvelasco 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

professor-redwood's Issues

Docker support

Containerize this thing to make it more readily available and easier to deploy, more so once database is enabled

Memory Issues

Currently Redwood seems to be using an unusual amount of memory on startup and requires some clean up.

Keeping issue open for a spike on what's going on.

save failed commands

lets find out what users are trying to do with the bot and are failing at. we might see some new functionality people want or common misuses

Adding optional weather emoji at end of raid alert.

I'm trying to add a weather-boosted icon/emoji at the end of the line that the bot puts in the gymraid_alerts channel. I'm pretty certain the src>client.js file is where I need to do it. I attempted to write it myself, using the format of lines 17 - 26, but I got a syntax error that said "getEmoji has already been identified".

Not sure where I should put it for weather. This is what I have, but the bot doesn't work now because of the addition I made.

const getEmoji = (pokemon, weather) => {
var emoji = pokemon;
if (pokemon === 'ho-oh') {
emoji = 'hooh'; // special case for ho-oh
}
var emoji = weather;
if (weather === 'windy') {
emoji = 'wind'; // special case for windy
}
if (emojisByName[emoji]) {
return '<:' + emoji + ':' + emojisByName[emoji].id + '>';
}
return '';
};

Basically, the command !raid boss minutesLeft location I'd have weather at the end:

!raid latios 42 Park windy

And it would put the windy emoji at the end of it or whichever one I need.

Note that the weather part would be only optional just to notify it's boosted.

Not certain if this is the only command line I need to edit for this to work.

I'm no programmer. I have to reverse engineer, so to speak, the code in order to add more, but I can't seem to figure this out.

Reporting evolved pokemon in the wild - add additional !want notification as a stopgap

Originally we talked about "candy families" so that reporting a blissey would alert users who subscribed to !want chansey. This would avoid having to create separate roles for every evolution.

In the meantime before that happens, can we add blissey to the bot so users can subscribe to !want ? This is the most common final evolution requested.

Thanks!

Move secrets to environment variables

I think it would be a great idea to have the functionality to move secrets into environment variables instead of relying only on the secrets.json. For example, deploying on heroku requires a git repo and we wouldn't want to commit the secrets.

Maybe in bot.js we can do something along the lines of

const config = (process.env.DEBUG == "true") ? require('./config/secrets.json') :
 {
   "discord": {
     "token": process.env.DISCORD_TOKEN,
     "BOTID": process.env.DISCORD_BOTID
   },
   "mysql": {
     "host": process.env.MYSQL_HOST,
     "user": process.env.MYSQL_USER,
     "password": process.env.MYSQL_PASSWORD,
     "database": process.env.MYSQL_DB
   },
   "webhook": {
     "log": {
       "id": process.env.WEBHOOK_ID,
       "token": process.env.WEBHOOK_TOKEN
     }
   }
 };

Remove static data

To make this bot truly great there should be no static data. For instance

  • monstors
  • counters
  • breakpoints
  • cps
  • guild channels
  • guild emojis
  • start_here channel name

The guild info should just get pulled from the message.guild as needed. Everything else should be database driven which could also be changed if need be later on

Convert @ system to !wild

Users misuse @ all the time - convert to !wild and allow Redwood to handle the mention and forward an alert into the regional channel

Having the Professor use animated emoji instead of regular.

I use Nitro, so I don't know if that makes a difference.

I found this:

https://www.reddit.com/r/discordapp/comments/7lu48t/so_are_bots_able_to_use_animated_emoji/

But didn't seem to work.

Can the professor use the animated emoji over regular?

I can't seem to find code that tells it to pull from specific emoji.

I'm pretty certain Discord calls them "Animated Emoji" vs "Emoji" but I could be mistaken.

I use the sprites that are datamined from the game, but some can be really small. The animated versions would be ideal if usable.

Incorrect parsing in egg command

Trying to find the index of minutesLeft inside message.content string results in unintended detail message.

Example:
!egg 5 5 test description

Intended output:
@tier5 raid egg reported to #gymraids_alerts (hatching: 12:33am) at test description added by username
Current output:
@tier5 raid egg reported to #gymraids_alerts (hatching: 12:33am) at 5 test description added by username

Raid Message Consistency

The raid reporting done to granular/specific channels (san mateo/foster city) is different than the messaging from the region channels.

Would it make sense to have these more uniform? If so, I can add this into #33 since I am working on that anyway.

Adding typehints?

I have a local branch that adds flow support to the project, annotates a few modules, and includes third-party annotations for discord.js, mocha, and mysql.

I can clean it up a bit and submit a PR, but wanted to ask if this was something you would be interested in having first.

Happy to discuss merits/drawbacks here or on discord. lmk.

If anyone cares about style

Professor-Redwood\controllers\switches.js
  32:7  error  Parsing error: Unexpected token function

Professor-Redwood\src\chatcommands\egg.js
  52:11  error  Expected '===' and instead saw '=='                 eqeqeq
  58:11  error  Expected '===' and instead saw '=='                 eqeqeq
  59:11  error  Expected '===' and instead saw '=='                 eqeqeq
  89:6   error  'keyWordLength' is assigned a value but never used  no-unused-vars

Professor-Redwood\src\chatcommands\hide.js
  35:56  error  Expected '===' and instead saw '=='  eqeqeq

Professor-Redwood\src\chatcommands\mod.js
  26:17  error  Expected '===' and instead saw '=='  eqeqeq

Professor-Redwood\src\chatcommands\quest.js
  17:6  error  'inNeighborhood' is assigned a value but never used  no-unused-vars
  95:3  error  Unexpected console statement                         no-console

Professor-Redwood\src\chatcommands\raidcp.js
  24:15  error  Expected '===' and instead saw '=='  eqeqeq

Professor-Redwood\src\chatcommands\reset.js
  12:53  error  Expected '===' and instead saw '=='  eqeqeq

Professor-Redwood\src\chatcommands\wild.js
  18:6  error  'inNeighborhood' is assigned a value but never used  no-unused-vars
  58:3  error  Unexpected console statement                         no-console

Professor-Redwood\src\constants.js
  13:7  error  'alphanumeric' is assigned a value but never used  no-unused-vars
  21:7  error  'tagOrComment' is assigned a value but never used  no-unused-vars

Few updates for the Professor

Updated counters.json with all Pokemon from Gens 1-5 including placeholders for the known Galarian form Pokemon. Will update when the expansions come out for Sword/Shield.

Updated cp.json with CPs for all Pokemon Gens 1-5 including alternate forms.

Updated moves.json to include current moves. Waiting on stats for Aeroblast and Sacred Sword.

Updated pokemon.json with ALL Pokemon including ALL known forms. Gen's 6-8 have placeholders entered with stats from PokemonGoHub. Will update as those gens are live.

Updated string.json for perfect CP strings for levels 1-35 for all Pokemon Gens 1-5 including alternate forms.

I apparently don't know how to upload those files via this method. Let me know and I will send them to whoever I need to.

Also, I will update counters.json when Gen 6 is live and most of the Pokemon will be updated with recommended counters that will include Gen 6.

Distinguishing Commands

sparklerfish L36 Mystic - Today at 7:43 AM

Is there any way to have the bot distinguish between a command run in the wrong channel and a misspelled command/something that isn't a command? Sometimes people accidentally mix up the format for the raid command and do something like !moltres 54 whatever location and the bot tells them "this command can only be run in #professor_redwood ". For things that aren't commands, could it say something like "Command not found. Type !help in #professor_redwood for help."

I was thinking that we could change up the way the commands are setup. Currently we are using if statements to process each command. It may be better to use something like switch and case statements to evaluate the commands that come in, and it would make the cases more readable.

Gymraid alerts should have exgym tag

Currently, gymraid alerts only have the name, channel, location, and details. It would be nice to have an exgym tag so people looking at the gymraid alerts for their region can decide which raid would be worth going to.

attach map locations to gyms?

Hey,

It's tough to find exactly where gyms are without asking people, especially while on mobile. people seem have shared google maps with lots of pins, which is better than nothing.

Would a PR allowing users to note gym names and locations be accepted? Would need to do some fuzzy matching, allow users to add/update/change stuff (or at least some authorized users). Also either when redwood restates the raid, it could include a shortlink to the map location as well as a optional short descriptive text (ie; "el camino and something"), or simply be another command users could use.

@mralanlee - Looks like you're the current active maintainer. Thoughts? Seems like you've been poking at a few options for adding a database to the bot, not clear where you landed on that. I'd have to extend from whatever that is.

Thanks!

Invite code expired

Your invite code, or discord link in your README does not work; I'm looking forward to see it in action and available commands

broken travis build

current travis.yml file has the old deployment code for gcp. going to clean things up a bit and get some testing going on.

Add !raids

Save raids with an object or databsae to allow usersto see current raids in their neighborhood

quoted message considered for moderation

When quoting a message from the bot that contains a privileged tag such as @tier5 the bot will show rage to the poster.

expected: quoted message should not processed by the bot.

Screenshot_20200705-124228

Need Owners

I started a new job a couple months back which led to me abandoning both the game and the bot. @pjlangsam seems mostly out of commission too with the bot so I need to give this project more owners.

@kniteshift ?
@awilbur ?

Active developers?

@mralanlee are you still interested in maintaining this repo alone? If not, lets get write privileges to some more devs.

I am inactive but don't want to completely abandon the repo as it seems like the bot is still used.

Constants Refactor

Change the data structure in constants.js where Array is used to a nested object.

Using a hash lookup would be more optimal than using indexOf or other array methods.

Add !hide

add the user to the overridePermissions object for the channel and set readMessages = false to hide the channel for the user. Only use in neighborhood channels (channel.name has '-'

Ignore !commands which aren't valid on the bot

This bot should completely ignore any !command which does not work with the bot.

Many bots use commands which start with "!" (e.g. !clear (Mee6Bot), !setup, etc). This bot currently returns a response ("<message.member.displayName>, you may only run this command in the #professor_redwood channel") for any !command.

My workaround, which obsoletes the errorMessage handling at the end of client.js:
constants.js:

const data = {
	COMMANDS: ['breakpoint', 'checknew', 'egg', 'help', 'hide', 'mod', 'play', 'raid',
		 'reset', 'team', 'want', 'wild']

client.js:

	//Ignore any !commands not listed in the CONSTANT.COMMANDS list
	if (CONSTANTS.COMMANDS.indexOf(command.slice(1)) <= -1) {
		return;
	}

Remove need to manually tag shiny pokemon

Since we already do a lookup on the tagged pokemon to see if there is a discord role and emoji for that pokemon (eg. !wild pokemon will check to see if we have a @pokemon role and :pokemon: emoji) we can probably drop support for users reporting shinycheck.

We will still have the @shinycheck role so users can decide if they want to get notified for potential shiny pokemon, but we should REMOVE the logic where the bot will search the message for anything with shiny in it, and then add in the @shinycheck role at the end.

For this to fully work, we need to cross check the reported !wild pokemon against a list of known potential shinies.

Automated Messaging for Team Assignments

Instead of having users go into a channel to assign a team via command, could unassigned users be automated a one time message?

Case:

  • If a new user joins, automatically receive a message about assignment via DM
  • If an existing user is unassigned, DM user about team assignments.

Pitfalls:

  • Every time we refresh the bot, all unassigned users will get a DM. However, we only really restart the bot to push new features.

Thoughts?

I can take this on after #33

Incorrect parsing for quests with caps

!quest Silver pinap foo

expected:
QUEST @silver_pinap :silver_pinap: Details: silver pinap foo added by name

actual:
QUEST SILVER Details: Silver pinap foo added by name

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.