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

Alternate Display for Username in Discord #154

Merged
merged 12 commits into from Mar 27, 2023
Merged

Conversation

PPTide
Copy link
Contributor

@PPTide PPTide commented Mar 20, 2023

Edit: This requires the bot to have the permissions manage Webhooks (I think I just gave it Admin xD)

@PPTide
Copy link
Contributor Author

PPTide commented Mar 20, 2023

Screenshot 2023-03-20 at 21 34 56

It looks like this.

Idk if this fits the theme of devzat but I was bored :)

@quackduck
Copy link
Owner

That's such a cool idea! I think this would be great as an optional thing in the discord integration config. It takes up more vertical space but I see the appeal.

@PPTide
Copy link
Contributor Author

PPTide commented Mar 23, 2023

I want to add a pfp depending on the color of the username and I have 3 idea how to do it but want your input @quackduck ...

  • open up a port on devzat to host the images
  • add a micro service on another machine/the same machine to generate/host the images
  • upload them to another channel on discord and then get a url from there (you can upload images to discord but can't use the in the pfp of a webhook...)

@quackduck
Copy link
Owner

I don't really want to make Devzat, which is an SSH server, also an HTTP server but since this is an optional feature, maybe it's okay. I'm thinking that an implementation could work like this:

  1. User sends message
  2. Discord integration sets avatar_url to "/pfps/.png"
  3. An HTTP server listens for connections to /pfps and uses the color description to send back a very minimal generated image to Discord

The hard part is keeping the terminal colors and discord colors the same, because the way messages work in Devzat means that they don't encode color information. So, I think we'd have to just make the color the result of some sender-name-based function. (eg. hash sender name, then convert hash into RGB values with math).

Ultimately the end result would be pfps with colors that don't match those in the terminal and are only sender-name-dependent (meaning that if someone changes their name, the color will change too), which is kind of not that big an improvement and now involves a whole HTTP server and PNG generating - all of which presents opportunities for holes and DoS attacks from @TAG-Epic. So yeah idk if we should do this. What do you and @Arkaeriit think?

@quackduck quackduck closed this Mar 24, 2023
@quackduck
Copy link
Owner

oops, closed by mistake

@quackduck quackduck reopened this Mar 24, 2023
@pull-request-size pull-request-size bot added size/L and removed size/M labels Mar 24, 2023
@PPTide
Copy link
Contributor Author

PPTide commented Mar 24, 2023

Added Profile picture colors :)

@quackduck
Copy link
Owner

That's awesome! Could you attach an example demo screenshot?

@PPTide
Copy link
Contributor Author

PPTide commented Mar 24, 2023

Profile pictures on Discord compared to Devzat usernames:
Screenshot 2023-03-24 at 18 32 32

@quackduck
Copy link
Owner

Oh my god that's beautiful

@quackduck
Copy link
Owner

I wonder if something similar is possible in slack

@PPTide
Copy link
Contributor Author

PPTide commented Mar 24, 2023

https://api.slack.com/methods/chat.postMessage#authorship

This is what I found looking through the slack api documentation maybe there'll be the same problem... i don't really know slack tho...

Edit: url got cut

@Arkaeriit
Copy link
Contributor

Can the inverse transform be applied to messages send on Discord and read from SSH? It would be nice if the name of Discord users on SSH mirrored the color of their profile pictures.
But this is probably out of the scope of this PR as this probably require quite a bit of work as far as image processing goes.

@PPTide
Copy link
Contributor Author

PPTide commented Mar 27, 2023

Can the inverse transform be applied to messages send on Discord and read from SSH? It would be nice if the name of Discord users on SSH mirrored the color of their profile pictures.

But this is probably out of the scope of this PR as this probably require quite a bit of work as far as image processing goes.

Maybe create a new issue?

@quackduck
Copy link
Owner

This is such a cool feature that I think we should make this the default discord mode. Is there any extra set-up needed on the Discord side?

@PPTide
Copy link
Contributor Author

PPTide commented Mar 27, 2023

This is such a cool feature that I think we should make this the default discord mode. Is there any extra set-up needed on the Discord side?

It needs "Manage Webhooks" and "Message Content Intent".
Doesn't need "Send Message" anymore.

@quackduck
Copy link
Owner

well it would need send message for the new non-default setting

@quackduck
Copy link
Owner

This is such a cool feature that I think we should make this the default discord mode. Is there any extra set-up needed on the Discord side?

It needs "Manage Webhooks" and "Message Content Intent".

Doesn't need "Send Message" anymore.

Might need an update to the docs in that case

@quackduck
Copy link
Owner

I think we just need to confirm I didn't break anything with my changes

@quackduck
Copy link
Owner

Just tested, seems not to have broken anything!
image

@quackduck quackduck merged commit 21f2096 into quackduck:main Mar 27, 2023
0 of 2 checks passed
@quackduck
Copy link
Owner

Epic PR, thanks for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants