In Africa A Biography of the Continent, the author notes that at some point demand for guns dropped during the slave trade and he infers that local Africans (and their blacksmiths) had learned enough about how guns functioned so that they could repair them. But as far as I know, there's no evidence that any west African polity got to the point where they were manufacturing their own guns and gunpowder like the Japanese with their Tanegashimas.