Git Product home page Git Product logo

porygon-z's Introduction

Smogon

@pkmn's unofficial APIs for Smogon's analysis, moveset, sample teams, and usage statistics data.

Smogon does not officially provide any API for third party developers, and is at liberty to make breaking changes to its internal data representations at any point - this project attempts to provide a stable way of accessing the data Smogon exposes on its site. Two packages are provided:

  • smogon: A low-level wrapper around Smogon's analysis and statistics endpoints used to ergonomically fetch raw data via point queries from the source.
  • @pkmn/smogon: A rich client for the processed and aggregated Smogon analysis and moveset information available at data.pkmn.cc.

data.pkmn.cc contains several curated datasets pulled from Smogon and Pokémon Showdown which have been processed to allow for efficient batch access of analysis, sets, teams, and statistics data by format or generation. Analysis and set data is refreshed automatically every 24 hours as are sample teams, the best stats data for each generation is converted each month into @pkmn/stats's optimized output format, and information about Pokémon Showdown’s standard Random Battle formats from pkmn/randbats is updated hourly.

The API for these endpoints is documented though subject to change - developers relying on these endpoints should join the Discord to keep abreast of updates and/or rely on the latest version of the @pkmn/smogon package to simplify the data handling.

While this project's code is distributed under the terms of the MIT License and the aggregated stats information is freely available in the public domain, the set and analysis data is copyrighted by Smogon and its contributors.

porygon-z's People

Contributors

annikacodes avatar dependabot[bot] avatar eternalrisen avatar hoeencoder avatar monsanto avatar thejetou avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

porygon-z's Issues

Handle News Channel Messages better

Discord allows users with webhook permissions to subscribe to new channels from other servers. Currently when Porygon-Z sees a news channel subscription message, its apparently treating it as a user and inserting information about it into the postgres database.

A sample of one of these messages from the server where it originate can be seen here:
image

users table:
image
userlist table:
image

Interestingly, there is no entry for the lines table. In addition I'm unsure what this ID is exactly as its not the server or channel in question. Regardless this is not considered to be a user by discord and could cause issues so steps should be taken to identify and not insert data from these new subscriptions into the database.

Also on a side note manually setup webhooks such as the github webhook in the official smogon development discord don't appear to be getting inserted into the database atm.

Showing me this error

status: 1,
signal: null,
output: [ null, null, null ],
pid: 13168,
stdout: null,
stderr: null
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: node -r dotenv/config bot
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

BaseCommand.getChannel - Option to ignore channels a user cannot access.

The getChannel method on the BaseCommand class should have some kind of option to only return channels a specific user can see. Currently, the options are simply any channel the bot can access or only channels in the server (guild) that the command is being run in.

This change would require some kind of toggle able flag (that preferably defaults to false but im always open to discussion). The check needs to take both the user's permissions via role into account, as well as specific channel overrides into account.

Anyone is welcome to take this, I will handle it myself if nobody does.

Nitro Boost Plugin (Commands)

  • Command to list current boosters
  • Notify in channel when a boost starts
  • Notify in channel when a boost ends
  • Command to a set a channel as a log channel & methods to log to it if it exists
  • Method that updates boosters, runs on start up and at midnight.

Add unit tests

I'm making this issue to track unit test progress. @HoeenCoder can you assign me? @smogon/trusted doesn't have self- assign permissions here.

Enable strict typechecking

"strict": true in tsconfig.json compilerOptions.

Currently cannot build due to the following type error:

src/command_base.ts:37:3 - error TS2322: Type 'string | undefined' is not assignable to type 'string'.
  Type 'undefined' is not assignable to type 'string'.

37      this.cmd = parts.shift();
        ~~~~~~~~

Startup Hook

Create a way to hook methods from command/monitor files the ready event for the bot. I want this to be done so that events that need to be done when the bot first starts but also need the bot to be connected to discord to work can be fired at the appropriate time.

Work out a permissions system

There's currently not a permissions system and when one is eventually created, should it be done on a by-role basis or user-specific basis or what? (Conversation below for context)

[2:17 PM] Kris: is anyone working on the permission system for the bot actively or n? i have some ways to do it in discord.js
[2:17 PM] chaos: which bot?
[2:18 PM] Kris: porygon-z
[2:19 PM] chaos: unless @HoeenHero has uncommited changes, i do not think so
[2:19 PM] Kris: i saw acomment about looking into handling permissions earlier so i thought i should offer to help
[2:19 PM] Kris: (comment in the code)
[2:19 PM] HoeenHero: Added to the project board under design (we need to decide how to do it before doing it)
[2:19 PM] HoeenHero: If you want to create an issue to discuss it go for it

Log deleted messages to a channel

When a message is deleted, log information to the log channel. Information should include the author, who deleted it, and the content. I'm assuming this is all possible, but further research may be needed.

Persistant Roles

This feature would allow moderators to assign a role to a user through Porygon-Z. If they leave through any means (personal choice, kick, ban & unban) and rejoin after after the bot should automatically re-assign these persistent roles.

To Discuss

  • Should the roles assignable be limited? If so how do we set which roles can be persistent. Remember PZ supports multiple servers so we can't hardcode this. (see #17 (comment) )

To Do

  • Command to make a role persistent. Also tracks (records they have the role in server X) all users currently with the role.
  • Command to reverse this. Also stops tracking the users mentioned above.
  • Database version change to support persistent role tracking.
  • Event listener for when a user joins a server to handle re-assigning roles as needed.
  • Debugging

Other Notes
The required permission should probably be the ability to assign roles to users.

Database Table Version Control

From @thejetou 7b061bc#r37860540

You might want to use a migration library [0] for increased flexibility with rolling forward / rolling back.

[0] - https://www.npmjs.com/package/postgrator, https://www.npmjs.com/package/node-pg-migrate etc.

Yes, we should do something like this, good catch. I'm open to using one of these, a different library, or something house made. I skimmed over the libraries last night and currently I prefer the former (postgrator) though I'm open to all the other options still.

Whatever we do it should allow the bot to upgrade the database from an older commit's version to whatever it currently needs to run. If you interested in taking this on, feel free otherwise I'll get to it sooner rather than later.

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.