Open NilsKrause opened 4 years ago
I thought about this as well, but I think due to the limitations of the Discord nickname feature this is practically impossible, as Discord automatically changes your nickname in all text channels retroactively. Meaning that varying nicknames won't really work.
Exactly, maybe I was unclear. What I mean was that the bot changes the message itself, not the name of the user as thats not possible as you described.
Oh I see what you mean, misread it at first. I'm not sure how fast the bot can realistically react to sent messages by users, but that may be tested out, good idea!
So to summerize
User sends message: "Hello there!" Bot edits message to: "General Kenobi: Hello there!"
What needs to be worked out, is how to organize the data structure. Currently nicknames are saved in a json file with original username, userid aswell as an array of registrations. Each registration has an voice channel ID and the corresponding nickname. Perhaps there should be an additional file that collects the same data for text channels.
Yeah exactly like that. But you don't need to track that in a different file, you could just check if its voice channel or a textchannel and react accordingly.
The main problem is, it is possible to have multiple channels with the same name. So it's important to make sure the user has the option so select the correct one. Maybe that would be possible by alerting the user that there are multiple channels with the same name and that they should use the channel ID instead of the name.
But that presumes that we need the feature to add a channel by id.
I was messing around with manipulating text channels with this bot the other day and the only thing stopping it from collecting text channels is the voice channel check in gatherChannels(). I commented that out and the bot was storing nicknames for text channels just fine.
There is still the problem of rapid message editing. I don't know for sure but I think an async bot.on(message) should work.
Just as a future note. It would be very helpfull to implement a similar feature for textchannels. It's a bit harder for these, as you are never in only one single text channel. Maybe we could work on a concept together to implement that feature.
My current idea is to edit the message of the user with the nickname infront of the message. Something like this: I am registered as 'Rudolf' on the Channel 'RP' and send a message there with the content 'Hey there, long time no see!'. It instantly gets changed by the bot to 'Rudolf: "Hey there, long time no see!"' or something of the sort.
What do you think, what are yout ideas?