mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
refactor(brokers): make option props more correct (#10242)
* refactor(brokers): make option props more correct BREAKING CHANGE: Classes now take redis client as standalone parameter, various props from the base option interface moved to redis options * chore: update comment --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -40,7 +40,7 @@ pnpm add @discordjs/brokers
|
||||
import { PubSubRedisBroker } from '@discordjs/brokers';
|
||||
import Redis from 'ioredis';
|
||||
|
||||
const broker = new PubSubRedisBroker({ redisClient: new Redis() });
|
||||
const broker = new PubSubRedisBroker(new Redis());
|
||||
|
||||
await broker.publish('test', 'Hello World!');
|
||||
await broker.destroy();
|
||||
@@ -49,7 +49,7 @@ await broker.destroy();
|
||||
import { PubSubRedisBroker } from '@discordjs/brokers';
|
||||
import Redis from 'ioredis';
|
||||
|
||||
const broker = new PubSubRedisBroker({ redisClient: new Redis() });
|
||||
const broker = new PubSubRedisBroker(new Redis());
|
||||
broker.on('test', ({ data, ack }) => {
|
||||
console.log(data);
|
||||
void ack();
|
||||
@@ -65,7 +65,7 @@ await broker.subscribe('subscribers', ['test']);
|
||||
import { RPCRedisBroker } from '@discordjs/brokers';
|
||||
import Redis from 'ioredis';
|
||||
|
||||
const broker = new RPCRedisBroker({ redisClient: new Redis() });
|
||||
const broker = new RPCRedisBroker(new Redis());
|
||||
|
||||
console.log(await broker.call('testcall', 'Hello World!'));
|
||||
await broker.destroy();
|
||||
@@ -74,7 +74,7 @@ await broker.destroy();
|
||||
import { RPCRedisBroker } from '@discordjs/brokers';
|
||||
import Redis from 'ioredis';
|
||||
|
||||
const broker = new RPCRedisBroker({ redisClient: new Redis() });
|
||||
const broker = new RPCRedisBroker(new Redis());
|
||||
broker.on('testcall', ({ data, ack, reply }) => {
|
||||
console.log('responder', data);
|
||||
void ack();
|
||||
|
||||
Reference in New Issue
Block a user