popiiClient()
Popii / popiiClient
Function: popiiClient()
Section titled “Function: popiiClient()”popiiClient<
TState>(config):PopiiClient<TState>
Defined in: client.ts:216
Creates and returns a new Popii client instance.
Call client.start() after configuring it to connect to Discord and begin
loading commands, events, snaps, middlewares, and tasks from their directories.
Type Parameters
Section titled “Type Parameters”TState
Section titled “TState”TState = any
Parameters
Section titled “Parameters”config
Section titled “config”PopiiClientConfig<TState>
Returns
Section titled “Returns”PopiiClient<TState>
Examples
Section titled “Examples”import { popiiClient } from "popii";
const client = popiiClient({ token: process.env.DISCORD_TOKEN! });client.start();import { popiiClient, sqlitePlugin, webPlugin, errorHandlerPlugin } from "popii";
const client = popiiClient({ token: process.env.DISCORD_TOKEN!, devGuildId: process.env.DEV_GUILD_ID, owners: [process.env.OWNER_ID!], state: { totalCommands: 0 }, plugins: [ sqlitePlugin(), webPlugin({ publicUrl: "https://bot.example.com", oauth: { clientId: process.env.DISCORD_CLIENT_ID!, clientSecret: process.env.DISCORD_CLIENT_SECRET! }, }), errorHandlerPlugin(), ]});
client.start();