Git Product home page Git Product logo

2kai2kai2 / eu4img Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 62.13 MB

A Discord bot for the video game EU4 that creates in-channel post-game reports, organizes game reservations, etc.

License: GNU General Public License v3.0

Python 77.69% C++ 22.12% Dockerfile 0.05% Shell 0.12% Procfile 0.01%
games eu4 europa-universalis-4 europa-universalis-iv after-action-report eu4-multiplayer scheduler discord discord-bot discord-py

eu4img's People

Contributors

2kai2kai2 avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

eu4img's Issues

Stats: Make .eu4 file reading faster

Need to reduce processing on each line to increase speed. The file is very large, meaning small differences per line can have a major effect.

/help in controlled channels

/help should replace HELP in controlled channels. The context should be determined and the appropriate help message for the channel should be displayed.

Load save data on startup

Save data needs to be loaded on startup.
On_ready, copy all the still valid reserve channels into interactions

Customization for shown data

Could be either:
a. Settings file
b. Enter order in program (would need to be implemented without being too much work for users)

Switch Guild data to MongoDB

Unlike with reserves, this will not revolve around objects. Each function will simply have a parameter to specify guild. However, similarly to reserves, data will be stored on the database unless some local caching is implemented.

  • Default bans
  • Announcements (Implementation Pending)
  • Admin rank

Potential items:

  • Time zone
  • Default ASI-type teams
  • Server management
  • Player attendance checking

Switch Reserves to MongoDB

Controlled channels own a Reserve (or ASIReserve) object that is essentially a wrapper for a bunch of database calls, only keeping the channel ID that identifies all relevant data.
On MongoDB, all the data for reservations is stored in the conveniently-named "reservations" database. It has one collection called "index" that contains a document for each Reserve or ASI Reserve channel with data for each. There is then another collection for each of these, with a name consisting of a string of its channel ID (all digits) that contains a document for each player that has a reservation. Both the index and pick collection are identified by channel ID.

We could implement some sort of local caching of data eventually.

Errors if a guild doesn't have the specified rank

2019-12-16T03:32:59.893019+00:00 app[worker.1]: Ignoring exception in on_message
2019-12-16T03:33:00.002903+00:00 app[worker.1]: Traceback (most recent call last):
2019-12-16T03:33:00.005012+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/discord/client.py", line 270, in _run_event
2019-12-16T03:33:00.005016+00:00 app[worker.1]: await coro(*args, **kwargs)
2019-12-16T03:33:00.005023+00:00 app[worker.1]: File "EU4Bot.py", line 944, in on_message
2019-12-16T03:33:00.005025+00:00 app[worker.1]: elif (text.upper() == prefix + "NEW") and checkResAdmin(message.guild, message.author):
2019-12-16T03:33:00.005027+00:00 app[worker.1]: File "EU4Bot.py", line 97, in checkResAdmin
2019-12-16T03:33:00.005030+00:00 app[worker.1]: return getRoleFromStr(s, os.getenv("MIN_ADMIN")) <= u.top_role
2019-12-16T03:33:00.005098+00:00 app[worker.1]: TypeError: '<=' not supported between instances of 'NoneType' and 'Role'

Plan data structures and flow

-Guilds
-Reserves (different types)
-Be future-proofed to be able to save other kinds of controlled channels?

Determine how much of the data should be stored in memory/cached and for how long

  • Lookup performance
  • Memory usage
  • Sharding (is it irrelevant if each guild only has one shard?)

Readme Link to Discord Doesn't Work

Hi,

Not sure if you're still working on this project, but I was going to give it a try, but it looks like the link to ask for a bot link is broken. Intentional? If not, would love to see if I can get this to work for my savegame!

Increase map border drawing speed

While every other item in the process of drawing the stats image takes less than a second, deciding where to draw player nation borders can take upwards of a minute. Reducing this is the primary goal for stats image optimization.

Ensure all Discord snowflakes are stored and processed as ints

  • Mentions should be stripped and parsed
    • slash commands with role arguments give a string containing the int, which can be easily cast with int()
  • Storage in objects and variables

Standardize acceptable other inputs:
int
Guild/User/Member/Channel (we just get the id)
Do we accept strings that can be directly cast?

Stats: Political mapmode image is held indefinitely waiting for user response

The political mapmode image is held in memory indefinitely until the user completes player list modification for the stats interaction. This could be forever if the user never completes or cancels the interaction.
Solutions:

  • Get image after modification, resulting in no wait time
    • Solves
  • Get image URL from discord and load after modification
    • Solves
    • Could not work if file message is deleted, resulting in file deletion after 1-24 hours.

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.