Skip to content

Commit

Permalink
feat(*): support for client name & version (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrappachc authored May 25, 2022
1 parent 8cd80cf commit 8efb6da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/client-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ export interface ClientOptions extends ConnectionOptions {
*/
username: string;

/**
* Client name.
* Default: 'simple mumble bot'
*/
clientName?: string;

/**
* The interval the bot will send pings to the server (in milliseconds).
* It has to be less than 30000 (30 seconds), otherwise the server will kick the client.
Expand Down
6 changes: 5 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ import { encodeMumbleVersion } from './encode-mumble-version';
import { ClientOptions } from './client-options';
import { ConnectionRejectedError } from './errors';
import { filterPacket } from './rxjs-operators/filter-packet';
import { platform, release } from 'os';

const defaultOptions: Partial<ClientOptions> = {
port: 64738,
clientName: 'simple mumble bot',
pingInterval: 10000,
};

Expand Down Expand Up @@ -117,8 +119,10 @@ export class Client extends EventEmitter {
return await this.socket?.send(
Version,
Version.create({
release: 'simple mumble bot',
release: this.options.clientName,
version,
os: platform(),
osVersion: release(),
}),
);
}
Expand Down

0 comments on commit 8efb6da

Please sign in to comment.