Skip to content

Commit

Permalink
add seyfert support to shoukaku
Browse files Browse the repository at this point in the history
  • Loading branch information
EvilG-MC committed Feb 27, 2024
1 parent c59317c commit aeba819
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/connectors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ const { Shoukaku, Connectors } = require('shoukaku');
new Shoukaku(new Connectors.OceanicJS(client), servers, options)
```

> [Seyfert](https://seyfert-docs.vercel.app/) (0.1.x)
```js
const { Shoukaku, Connectors } = require('shoukaku');
new Shoukaku(new Connectors.Seyfert(client), servers, options)
```


> Implement your own
## Implementing your own
Expand Down
25 changes: 25 additions & 0 deletions src/connectors/libs/Seyfert.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Connector } from '../Connector';
import { NodeOption } from '../../Shoukaku';

export class Seyfert extends Connector {
// sendPacket is where your library send packets to Discord Gateway
public sendPacket(shardId: number, payload: any, important: boolean): void {
return this.client.gateway.send(shardId, payload);
}
// getId is a getter where the lib stores the client user (the one logged in as a bot) id
public getId(): string {
return this.client.botId;
}
// Listen attaches the event listener to the library you are using
public listen(nodes: NodeOption[]): void {
this.client.events.values.RAW = {
data: { name: "raw" },
run: (packet: any) => {
// Only attach to ready event once, refer to your library for its ready event
if (packet.t === "READY") return this.ready(nodes);
// Attach to the raw websocket event, this event must be 1:1 on spec with dapi (most libs implement this)
return this.raw(packet);
}
}
}
}
1 change: 1 addition & 0 deletions src/connectors/libs/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './DiscordJS';
export * from './Eris';
export * from './OceanicJS';
export * from "./Seyfert"

0 comments on commit aeba819

Please sign in to comment.