GithubHelp home page GithubHelp logo

kappeh / redstone-squid Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 2.0 314 KB

A custom bot designed to manage redstone records.

License: MIT License

Python 95.60% Procfile 0.02% PLpgSQL 4.38%
discord-bot gspread record python minecraft

redstone-squid's People

Contributors

fsfs3mk avatar glinte avatar spacewalkerrs avatar vipelyrs avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

vipelyrs fsfs3mk

redstone-squid's Issues

Support image and video better

  • Don't force resource urls that can be directly used to display images
  • maybe allow image/video attachments as part of /submit
  • display more than 1 image
  • display videos

Allow slash commands to show up in Help

Not sure how to get this done because our current Help class gets the available commands quite fundamentally from the prefix command tree abstracted away from us in discord.ext.commands and not from the CommandTree in discord.app_commands.

The reason why some commands (/submit, /edit) are not hybrid_command is because I didn't know how to use Context in place for Interaction.
https://discordpy.readthedocs.io/en/stable/ext/commands/api.html?highlight=context#discord.ext.commands.Context
https://discordpy.readthedocs.io/en/stable/interactions/api.html#interaction

A simple workaround may be to create an empty, hidden prefix command with the same name and parameters.

Properly escape strings

We don't escape any user input so the discord bot's embed formatting can break completely by it

Fuzzy search builds

This seems to be a very hard problem with dependency on

  1. Database normalization
  2. Convert the data into embeddings
  3. Use some sort of Approximate Nearest Neighbors algorithm

If we use exact searches instead then it will be easier and just need to write some queries

Use UTC time

There a handful of instances where local times are used without time zone information, for example

datetime.now().strftime(r'%Y-%m-%d %H:%M:%S.%f')

Times within the database should be stored in UTC. As such, these should be updated to use UTC, such as

datetime.utcnow().strftime(r'%Y-%m-%d %H:%M:%S.%f') // Edit: NOT THIS ONE

or

datetime.now(timezone.utc).strftime(r'%Y-%m-%d %H:%M:%S.%f')

Rework API keys retrival

Unify the API key store location, and make it path independent.

Sometimes I want to do some localized testing on the working file using if __name__ == "__main__":, but as soon as database is needed then it couldn't get the API key from auth.ini which is assumed to be in the working directory.

Getting the variables is also very ugly:

url = os.environ.get('SUPABASE_URL')
key = os.environ.get('SUPABASE_KEY')

if not url:
    if os.path.isfile('auth.ini'):
        config = configparser.ConfigParser()
        config.read('auth.ini')
        url = config.get('supabase', 'SUPABASE_URL')
    else:
        raise Exception('Specify supabase url either with an auth.ini or a SUPABASE_URL environment variable.')
if not key:
    if os.path.isfile('auth.ini'):
        config = configparser.ConfigParser()
        config.read('auth.ini')
        key = config.get('supabase', 'SUPABASE_KEY')
    else:
        raise Exception('Specify supabase key either with an auth.ini or a SUPABASE_KEY environment variable.')

Database normalization

Right now wiring_placement_restrictions, component_restrictions and creators_ign are stored as a string of comma separated list in the submissions table. Extract them to a new table for searchability.

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.