sm00th / bitlbee-discord

Bitlbee plugin for Discord (http://discordapp.com)
GNU General Public License v2.0
291 stars 27 forks source link

Question: How to send a file? #175

Open BurnyBoi opened 5 years ago

BurnyBoi commented 5 years ago

I'm struggling to understand how I can upload a file from my computer to a discord channel. I've read through the documentation for bitlbee and bitlbee-discord, and I'm still quite lost. The most relevant thing I've seen is the transfer command, but according to the docs this is just to "Monitor, cancel, or reject file transfers".

It's likely I just missed something, but is anyone aware of how to do this? (or if this is even possible)

dgw commented 5 years ago

I don't believe it's currently possible to upload files in bitlbee-discord. When I want to send a picture I either put it on Imgur or somewhere and send a link, or open the Discord site in my browser briefly and upload the image from there.

sm00th commented 5 years ago

This is currently not supported. To be honest it is unlikely to be implemented anytime soon unless someone interested posts a patch as most people (myself included) use the same method as @dgw for these uploads.

dgw commented 5 years ago

It would probably be, uh, "interesting" to implement this. About the only practical way I can think of to do it is building a DCC client/receiver of some sort into this plugin, harnessing the fact that BitlBee always has a "root" user available. There'd be no real way to build a UI for it though. It'd be pretty messy and technical.

(Basically, I'm saying there's no way I'm even going near this feature, lol.)

Alcaro commented 5 years ago

Another option would be put file on disk, give bitlbee the path somehow, and have it upload that.

But that only works if bitlbee is on the same machine as the client (or there's an sshfs mount or something), and if bitlbee has read access to the relevant path, so I'm not sure how much of our userbase could use that... but DCC's success isn't guaranteed either, it's quite variable how many TCP ports are available and unfirewalled between server and client.

Or perhaps there's some other option I'm not thinking of. Personally I'd just go with the white flag and telling people to open the original discord client, but I hope there's some fourth option I'm missing.

BurnyBoi commented 5 years ago

I think Alcaro is on the right track. So long as the file path you provide in your message is one that's on the machine Bitlbee is running on, this would work. I'm not aware of the majority's use case for Bitlbee, but in my case, I have bitlbee running on the same machine that I'm using Weechat.

This isn't quite the same thing, but I use the lua plugin for Matrix in Weechat, and it has a similar feature. Just to give an example of how the UI works for that, all I have to do it send a message like:

/upload /path/to/file

dgw commented 5 years ago

Without access to statistics (that BitlBee probably doesn't collect anyway), I can't say whether I'm in the majority, but I run BitlBee on a remote server with its own UID. It's obviously possible to copy a file up to the machine running BitlBee first, then send a command to the plugin with the path, but it would be cumbersome, especially since much of my usage is through a web-based IRC client and I can't always use ssh/scp from the machines I log in on.

Usually, to share an image to Discord I just "Copy image" from a browser tab and paste it into the relevant channel on Discord's website. I can't imagine how BitlBee would deal with that workflow. It would require a plugin for whatever client the user is connecting from. Granted, a client-side plugin could also automate the "upload file to server" step, and putting the pasted image into a temporary file and uploading that would be logical. The thing is, I don't see it happening. Clients that don't have any plugin API would simply be left out, and clients that do have one might not support all the needed features.

All that said: Don't take it as reason not to implement uploading from a path on the server. I wouldn't be able to use it most of the time, but if a big enough segment of BitlBee's user base could… go for it.