21 lines
509 B
JavaScript
21 lines
509 B
JavaScript
|
const wiki = require('wikipedia') //
|
||
|
module.exports = {
|
||
|
name: 'wiki',
|
||
|
|
||
|
async execute (context) {
|
||
|
const source = context.source
|
||
|
const args = context.arguments
|
||
|
try {
|
||
|
const page = await wiki.page(args.join(' '))
|
||
|
const summary = await page.summary()
|
||
|
//const definitions = await urban.define(args.join(' '))
|
||
|
|
||
|
|
||
|
source.sendFeedback({ text: summary.extract, color: 'green' })
|
||
|
|
||
|
} catch (e) {
|
||
|
source.sendFeedback({ text: e.toString(), color: 'red' })
|
||
|
}
|
||
|
}
|
||
|
}
|