Wiki isn't a Constructor
See original GitHub issueI was trying to build a bot that gets from wiki a simple summary about the User Search.
Everything is good, but gives a error saying Wiki isnt Constructor. Whats that?.
{ var Wiki = require('wikijs'); var term = args.join(' '); if (!term) { msg.channel.sendMessage("Please Enter a Term to Search for it in the Wiki."); return; } msg.channel.sendMessage(":mag_right: Searching for your Term..").then(m => { new Wiki().search(term, 1).then(function(data) { new Wiki().page(data.results[0]).then(function(page) { page.summary().then(function(summary) { var sumText = summary.toString().split('\n'); var continuation = function() { var paragraph = sumText.shift(); msg.channel.sendMessage(paragraph); console.log(paragraph); console.log(sumText); if (paragraph) { m.edit(paragraph); msg.channel.sendMessage(paragraph); msg.channel.sendMessage(sumText); } msg.channel.sendMessage(paragraph); }; continuation(); }); }); }, function(err) { m.edit(err); }); }) };
Thank you if you helped ^^
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Try converting all the
new Wiki()
's toWiki()
.Wiki is not a class anymore. It is a function which returns an object with other functions.
Also, to help remember this, I normally would use lower case when using and requiring.
Great!