Well its unpractical, how would the bot know to send the user a key who is trying to join a channel. That is only on the server side which is raw.
You would need to code a small scripplet say. Everyone should know the channel bots nick who want to join. They should msg the bot, with some trigger like '!rules' which would show them the rules, and in the end of the rules and terms of agreement display the key for joining that channel.
Or you can setup a #channelhelp for that #channel. Use your eggdrop in there, people would type on main '!rules' and the bot would msg them with the agreement or so and then with the key.
I would recommend a small rules or terms of agreement text here because we wouldnt want to flood the bot off, you would need to use flood-chan and flood-msg as well so it is a bit secure.
But then again to me this idea sounds pointless, no one will always ask the bot for the key, people will remember it unless you change it on a daily basis or so.
On the contrary:
If you really wana be elite, you can make a small, not small a bigger scripplet here. Make the bot define a random set of keys or choose keys from a random list, and after every 24hrs or 12hrs whatever you can make it change the channel key (select one from the list or generate one), and update that key in its "!rules", that would be a better way or so.
Then this will mean a new channel key every X hours and people would request for the new channel key to join in.