bot
bot copied to clipboard
KeyError on webhooks when running botstrap
Traceback (most recent call last):
...
File "C:\Users\wookie\Documents\GitHub\bot\botstrap.py", line 158, in <module>
webhook_channel_id = int(all_channels[webhook_name])
KeyError: 'big_brother'
Not worked out exactly what this is yet, although we should probably handle it and raise a clearer error/warning. fwiw this was me trying to run botstrap on my old test server, but I decided to just make a new one and it worked perfectly :D
It's not 100% backwards compatible with old severs. It's included in the guide that the server needs to comply exactly with the template that we have set up, otherwise matching will not work.
I agree on the clearer error though. Do you want to do it, or do you want me to take care of it ?
This error is, in part, a usage error. The bootstrap script is not intended to support old or random configurations, but to work from well-defined states. It’s trading off the maximum possible utility, with simplifying the program greatly.
To that end, I went through and manually updated the staff test server to make it fully compatible, and updated the template to make sure it works as expected. We’re also currently working on adding a sort of migration system to make sure you always have a server that is up to date and in the correct state without having to do any real effort.
I don’t believe this is an issue we can/should resolve.
@HassanAbouelela did you mean that we shouldn't do anything at all, or that we shouldn't try and handle the case fully (e.g. making the channel if it doesn't exist)?
I agree it's a usage error and we shouldn't try handle the case fully. I think the specific error was because I didn't have a channel with the correct name, so here it would make sense to raise a warning like with other things, so it's clear that it's not working due to a user error rather than a script error.
I think it's of limited utility to try and handle/warn on this case, considering it mostly occurred due to migrating from a legacy server. Someone not following the guide at all and starting with a completely blank server would get a different error, and someone starting from the guide won't get an error, it's only this shrinking subset of migrating users that would experience the error.
We're best of exiting the program at this point anyway instead of warning and powering through since misconfigured webhooks will cause further errors on bot startup that are a little unclear to diagnose (403s from discord).
I think this was fixed anyway as a side effect of https://github.com/python-discord/bot/commit/b30475b1fbabbf970dfe1af4801152f70d917080