discordbotlist
Version:
Integrate with discordbotlist.com and support voting rewards and promote your bot's stats on the website.
49 lines • 2.31 kB
TypeScript
/// <reference types="express" />
import type { Client as DjsClient, RESTPutAPIApplicationCommandsJSONBody } from "discord.js";
import type { Client as ErisClient } from "eris";
import { TypedEmitter } from "tiny-typed-emitter";
import { BotStats, RecentVotes, Vote } from "../api";
import { DBLError } from "../internal";
import { BaseAdapter, DjsAdapter, ErisAdapter } from "./adapters";
export interface DBLClientEvents<T extends BaseAdapter> {
error: (error: DBLError<{
client: DBLClient<T>;
error: unknown;
}>, client: DBLClient<T>) => any;
posted: (stats: BotStats, client: DBLClient<T>) => any;
vote: (vote: Vote, client: DBLClient<T>) => any;
}
export declare class DBLClient<T extends BaseAdapter> extends TypedEmitter<DBLClientEvents<T>> {
apiKey: string;
adapter: T;
private _useWebhooksSuggestionSent;
private _lastVote;
private _post;
private _voteCheck;
constructor(apiKey: string, adapter: T);
/** Get the bot's recent votes (within the past 12 hours). */
fetchRecentVotes(): Promise<RecentVotes>;
/** Post the slash commands your bot supports. These will be shown on your bot page. */
postBotCommands(commands: RESTPutAPIApplicationCommandsJSONBody): Promise<void>;
/** Post bot stats to be displayed on the website. */
postBotStats(stats?: BotStats): Promise<void>;
/** Stops this client from posting stats to DBL. */
stopPosting(): void;
/**
* Starts posting stats to DBL with the specified interval.
* @param interval Frequency with which to post bot stats. Defaults to every hour.
*/
startPosting(interval?: number): void;
/** Stops this client from polling for recent votes from DBL. */
stopPolling(): void;
private _checkVotes;
/**
* Starts polling for recent votes from DBL with the specified interval.
* @param interval Frequency with which to post bot stats. Defaults to every 5 minutes.
*/
startPolling(interval?: number): void;
webhook(secret: string): import("express").Handler;
}
export declare function createDjsClient(apiKey: string, client: DjsClient<true>): DBLClient<DjsAdapter>;
export declare function createErisClient(apiKey: string, client: ErisClient): DBLClient<ErisAdapter>;
//# sourceMappingURL=client.d.ts.map