Coder Social home page Coder Social logo

zacharytalis / alttextbot Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 18.11 MB

A Discord bot designed to reduce the message clutter associated with image alt-text. Also includes leaderboard functionality for alt-text submitters!

Home Page: https://zacharytalis.com/blog/atb

License: Apache License 2.0

Java 96.96% Dockerfile 0.19% Shell 1.84% PowerShell 1.01%
bot discord-bot javacord

alttextbot's People

Contributors

glossawy avatar zacharytalis avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

alttextbot's Issues

Start testing things with unit tests

Right now we should be testing things via unit tests. To get started with this, the leaderboard re-write should have at least 90% unit test coverage.

This will be considered a blocking change for 1.2

Automatically pull og:image:alt content from embedded links

Feature request:
When a user posts a link, visit the link to see if the webpage contains a meta tag with property="og:image:alt". If so, fetch and automatically post the content of this tag to the server.

Example:
Image link - https://mastodon.opportunis.me/@Grandasse_/106419305487796570
Head element -

<meta content="anakin padme meme :
– I've added subtitles to make my content accessible
– But not automatically generated ones, right ?
– ...
– but not or tomato call he gem her eight it ones, write ?" property="og:image:alt">

Consideration:
Depending on how the text-fetching functions, the fetch may contain escape characters (such as \n). If so, pretty up that dirty text like a good little bot.

Add eventing for better access to bot execution.

Looking to implement a small event architecture to enhance board commands.

The idea is that we could do something like:

bot.onCommandComplete(PingCommand.class, e -> e.success ? Boards.consume(e.userMessage) : somethingElse());

Commands would probably be:

  • onCommandStart(Class<CommandBody>, Consumer<CommandStartEvent>)
    • Get command start events for this bot, but only ones initiated for the given Command class (e.g. PingCommand.class)
  • onCommandStart(Consumer<CommandStartEvent>)
    • Get any command start events for this bot
  • onCommandComplete(Class<CommandBody>, Consumer<CommandCompleteEvent>)
    • Get command complete events for this bot, but only ones initiated for the given Command class
  • onCommandComplete(Consumer<CommandCompleteEvent>)
    • Get any command complete events

for now.

Add additional logging for when commands are not recognized

There's a bunch of logging that run in BOT_ENV=testing environments only, we should log some additional non-identifying info in production too. For instance:

  • When a message is received that is command-like but not an identifiable command
  • When a bot is added to a server

Anything else? Maybe.

Lack of alerting

0 notifications at the moment

Think we can setup an email system to forward through our domain email for basic lifecycle events, like a dead heartbeat, starting up, and shutting down. May be noisy in the worst case but can debounce it.

Bot stuck in loop: "Heartbeat not answered properly."

Issue: Bot was online but unresponsive, with the following message repeatedly appearing in the log:

[Javacord - Central Scheduler - 1] DEBUG org.javacord.core.util.gateway.Heart - Heartbeat not answered properly. This might be because of a busy websocket

The bot responded normally upon restart.

Proposed solution: (Somehow) detect that this issue has occurred, and restart the bot's container.

Repeated logging prefixes

Issue where there are repeated log message prefixes each time a command is executed, 1 new one is added per execution.

Milestone messages

Feature request:
DMs from the bot when a user reaches certain alt-text milestones.

Proposed milestones:
10 alt-texts, 25, 50, 100, 200, 300, 400, 500, 1000, 10000

Proposed message text:
Congrats! You've submitted [x] alt-texts to the server: [server-name]. [emote-based-on-milestone]

Rearrange commands within EntryPoint to match readme order

Current output on !atbhelp:

!atbhelp ~ Get all commands from AltTextBot in a direct message.
!atbping ~ Check to see if AltTextBot is alive.
!alt ~ Replace the user message with alt-text. Post your alt-text as a separate message with the format !alt [alt-text] (no brackets).
!atbboard ~ Post the AltTextBot leaderboard for this server.

Should be:

!atbhelp ~ Get all commands from AltTextBot in a direct message.
!atbping ~ Check to see if AltTextBot is alive.
!atbboard ~ Post the AltTextBot leaderboard for this server.
!alt ~ Replace the user message with alt-text. Post your alt-text as a separate message with the format !alt [alt-text] (no brackets).

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.