Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite with hikari #135

Merged
merged 33 commits into from Dec 31, 2022
Merged

Rewrite with hikari #135

merged 33 commits into from Dec 31, 2022

Conversation

AlexanderHott
Copy link
Collaborator

This is a basic structure for the discord bot. None of the features have been implemented yet.

@AlexanderHott AlexanderHott changed the title Basic bot structure with hikari Rewrite with hikari Dec 29, 2022
import nox
from nox.sessions import Session


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use pre-commit .. please do not add other project-specific style enforcement tools!

@@ -0,0 +1,406 @@
# -*- coding: utf-8 -*-
"""Example plugins for reference.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this 406 lines example file in the project? Could you maybe link this in a readme?

@andreaskoepf
Copy link
Collaborator

We will keep this PR open until we hit feature parity.

@lightbulb.implements(lightbulb.SlashCommand, lightbulb.PrefixCommand)
async def task_dm(ctx: lightbulb.Context):
"""Request a task from the backend."""
await ctx.respond("Please complete the task in your DMs")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these hard-coded message strings should ideally be moved outside the main code files for people to edit.

@AlexanderHott
Copy link
Collaborator Author

AlexanderHott commented Dec 30, 2022

I think the bot now has feature parity, correct me if I'm wrong.

Tasks

  • /work to start a new task
    (In the server)
    image
    (In DMs)
    image

  • User can select which type of task (rate_summary and summarize_story are not implemented yet)
    image

  • Correct API interaction though the api client.

  • Timeout/cancel handling (Accepting the task is a 1 min timeout, responding to the task is a 1 hour timeout)
    image

  • Embed templates (these are not "quickly editable" by people who unfamiliar with code, but they look a lot better)
    image

Text Labels

  • text labels through a message context menu
    I'm not sure how to report these to the backend yet, but the frontend is working.
    I chose to let the user edit what text they are labeling, but I do keep track if they edit the message. Should I change this?
    image
    image
    image
    image

Log Channel Configuration

  • /settings log_channel to set the log channel the bot sends completed task messages to.
    image
  • /settings get to get the current server settings
    image

I'll start cleaning up the code, here are my plans so far, but please mention anything that is missing.

Immediate

  • address TODO comments
  • user input validation
  • backend text labeling
  • switch logging to loguru and add more + better log messages
  • switch bot config to pydantic
  • switch nox sessions to precommit-hooks
  • move example.py to a markdown file
  • document codebase structure
  • docker setup (maybe?)

Quality of life / UI

  • improve bot message wording
  • switch most (if not all) bot messages to embeds
  • move all user facing messages (embeds) to a central place
  • add better images to embeds
  • /help
  • /tutorial

Waiting on

  • leaderboard / points

@AlexanderHott
Copy link
Collaborator Author

@yk you created #40, did you mean that users can add text labels to task responses or to any message?

Copy link
Collaborator

@andreaskoepf andreaskoepf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. API settings should be read from conf and I am still not sure about the large example file. Is this something special that you wrote specific for the project or is it something which is on the net and we could simply link to it? Currently it looks like a bit of junk (e.g. we also do not include full manual and examples to all other libs we use).

The comments that I made regarding the messages, external string-table/templates etc. could be addressed later after merging this. We should review the overall interaction concept first.

discord-bot/bot/bot.py Outdated Show resolved Hide resolved
discord-bot/bot/settings.py Show resolved Hide resolved
@AlexanderHott
Copy link
Collaborator Author

About the example file, it’s something I wrote to help new contributors get up to speed quickly with hikari. There are some examples online, but they are spread all over the place. I want to include it somewhere, even if that is in the project wiki or a gist.

@yk
Copy link
Collaborator

yk commented Dec 30, 2022

About the example file, it’s something I wrote to help new contributors get up to speed quickly with hikari. There are some examples online, but they are spread all over the place. I want to include it somewhere, even if that is in the project wiki or a gist.

I think the ideal way would be to put it into a gist, or maybe you already have it somewhere in an open repo, then link to that in discord-bot/README.md. Although I'm not particularly against having examples, but ideally these come in the form of unit tests, which I can see is a bit tricky with discord. So no strong opinions, but if the file exists somewhere already or if a gist is fine, then I think a link would be perfect. Otherwise including it seems ok.

Copy link
Collaborator

@andreaskoepf andreaskoepf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, ready for bot replacement.

@andreaskoepf andreaskoepf merged commit f151fa4 into LAION-AI:main Dec 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reimplement discord bot using hikari
4 participants