ClientAdapter
extendsEmitter<AdapterEvents<M>>
implementsAdapterResult<C, M>
Description
Adapts a messaging interface so a Bot can understand it
Example
class Adapter extends ClientAdapter {
protected register(options, hooks) {
// Client refers to anything that exposes a messaging interface
const client = new Client(options)
client.on("message", hooks.message)
client.on("ready", hooks.ready)
client.on("resume", hooks.ready)
client.on("disconnect", hooks.unready)
client.on("error", hooks.error)
return {
client,
methods: {
start: async () => client.start(),
getMessageContent: (message) => message
}
}
}
}
const adapter = new Adapter(options)
const bot = new Bot({ adapter, ... })
Generics
M
C
CO
Constructor
new ClientAdapter(options)
Parameters
options:
COProperties
client:
Cmethods:
unknown typeMethods
register(options, hooks)AdapterResult<C, M>
Middleware