Git Product home page Git Product logo

osm-discord-bot's People

Contributors

atrate avatar goodclover avatar kallejre avatar pre-commit-ci[bot] avatar wireguy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

osm-discord-bot's Issues

Tidy up code and split into multiple files.

The current code is a monolithic one-file mess.

At some point the following should probably be done:

  • A bunch of constants are defined in main.py that should probably be moved to the config.
  • Split everything into multiple files so it is better organised. Not sure how they work but I think this is what Cogs are for, slash-command supports them.
  • Clean the type annotations up, some are missing, some wrong. It doesn't help that discord.py doesn't have them (slash-command I think does).
  • Better code comments.

Add support for other syntaxes to specify inline reference to node/way/relation

At line 742, regex currently supports only formats like node/1234. Requesting feature to support phrases like nodes 1, 2, 5 and 6 or 3.

Half-tested solution ELM_INLINE_REGEX = rf"{SS}(node|way|relation)(?:s? |\/)({POS_INT}(?:(?:, | and | or | )(?:{POS_INT}))*){SE}. It might be good or bad idea to unify similar regex for lines 742, 743 and 744. New regex supports array separators , , and and or while accepting old node/123 format.

OSM-Discord-bot/main.py

Lines 742 to 744 in 1901b57

ELM_INLINE_REGEX = rf"{SS}(?:node|way|relation)\/{POS_INT}{SE}"
CHANGESET_INLINE_REGEX = rf"{SS}changeset\/{POS_INT}{SE}"
USER_INLINE_REGEX = rf"{SS}user\/[\w\-_]+{SE}"

Additional group-based regex processing may need to be implemented in on_message(). Since regex doesn't support repeating capturing groups, entire list of element ID-s are matched as single group (e.g 1, 2, 5 and 6 or 3) and needs next regex to match each {POS_INT} to find element ID-s individually.
For example line 755 becomes elms = [(elm[0], tuple(re.findall('\d+', elm[1]))) for elm in re.findall(ELM_INLINE_REGEX, msg.clean_content) instead of

elms = [elm.split("/") for elm in re.findall(ELM_INLINE_REGEX, msg.clean_content)]

PS. There's typo in readme.

I can't be bothered to list it, so just look at the [sameple config](sample_config.json) for now.

Hide `/close_suggestion` for non-powerful users.

At current /close_suggestion is shown in the list for people that don't have permission.
There is a check in place to make sure they are allowed, but it still shows in the list of commands.

I'm not sure if Discord supports this, maybe it would be good to split all powerful commands into a simple /power or /admin and then use sub-commands for the individual things?

Allow accepting and rejecting suggestions

If OSM-Discord-bot is going to replace Dyno's custom commands, it would be nice if it supported accepting and rejecting the posted suggestions in the form of a moderator-only command that could refer to the suggestion's (TBI) ID.

This would either append to the original message or create a reply with a message like "Suggestion X has been accepted/rejected".

Make commands usable by bridged Matrix users

At current, Matrix users are unable to use slash-commands, but they can use inline detection or "traditional" commands (e.g. ?help).
Adding the ability for the bot to detect if a message starts with /, and then treat it like a slash command would enable bridged users to use the commands.

Note that bridged users appear as bots.

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.