Skip to content

Feature/embeds#8

Closed
veeru153 wants to merge 4 commits intorewritefrom
feature/embeds
Closed

Feature/embeds#8
veeru153 wants to merge 4 commits intorewritefrom
feature/embeds

Conversation

@veeru153
Copy link
Copy Markdown

No description provided.

@veeru153 veeru153 linked an issue Dec 10, 2022 that may be closed by this pull request
Copy link
Copy Markdown
Collaborator

@ilikecubesnstuff ilikecubesnstuff left a comment

Choose a reason for hiding this comment

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

Thanks for writing up the embed commands Veeru! I would change the structure of this cog a bit:

  • Turn all the async functions inside embed into methods of the Embeds class
  • Move check, is_skip and is_done outside embed as well so they're accessible to the above

cogs/embeds.py Outdated

@commands.command()
async def embedraw(self, ctx: commands.Context):
async def embedraw(self, ctx: commands.Context, *, embed_data):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

embedraw should take in a channel ID (where to send the embed) as its first argument.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Do we always supply a channel_id in embedraw? Even if we want to send the embed in the same channel?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Disregard. Found an example and it seems that we do indeed send the channel_id: https://discord.com/channels/230296179991248896/349491266838462465/1049269313401524275

cogs/embeds.py Outdated
"""
raise NotImplementedError('Command requires implementation and permission set-up.')
try:
embed_body = json.loads(embed_data)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This implementation works, but it is not how embedraw works within IB.ai - the JSON used there takes the fields values as a list of 2-lists (a title string and a value string). However, I'm not sure if we want to preserve backwards compatibility or change this - maybe wait for feedback from Ray or Nathaneal.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think maintaining backwards compatibility would be good. Since I recall a lot of the embed_raw commands are pre-written and it'd be annoying to have to edit all of those.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Can you provide me a sample snippet of the JSON that we are currently using for testing?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Also, do we handle inline fields in the old method, and if not, should we be adding that functionality? It is a matter of parsing the JSON and checking whether the array has 2 elements or 3.

@ilikecubesnstuff
Copy link
Copy Markdown
Collaborator

See #53.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Embed/Embedraw

4 participants