discord-botinator
    Preparing search index...

    Class Bot<TUser>Abstract

    The heart of your bot. Subclass this to get started.

    Type Parameters

    Index

    Constructors

    Properties

    client: Client
    commands: Command<Bot<TUser>, TUser, Bot<TUser>>[] = []
    components: Component<Bot<TUser>, TUser, Bot<TUser>>[] = []
    errorPing: Role
    hasStarted: boolean = false
    log: Logger<ILogObj> = LOG_CONFIG.DEFAULT_LOGGER
    logChannel: TextChannel

    Methods

    • Gets a role by an id.

      Parameters

      • id: string

        Role id

      Returns Role

      Role

    • Beta

      Gets a user by its id. This will eventually be renamed to getUser probably.

      Parameters

      • id: string

        User id

      • guild: string = ""

      Returns TUser

    • Runs right before the client logs in.

      Returns void

    • Runs right before the application quits.

      Returns Promise<void>

    • Runs when the bot joins a guild.

      Parameters

      Returns Promise<void>

    • Runs when there is an interaction.

      Parameters

      Returns Promise<void>

    • Runs after the bot logs in.

      Parameters

      Returns Promise<void>

    • Runs when a message is sent.

      Parameters

      Returns Promise<void>

    • Runs when a user's voice state changes. See discord.js documentation for more information.

      Parameters

      Returns Promise<void>

    • Refreshes commands for all servers.

      It is recommended to hook this up to a command.

      Returns Promise<void>

      export default class RefreshCommand<TUser, TBot<TUser>> extends Command<TUser, TBot<TUser>> {
      public getName() { return "refresh"; }

      public create() {
      return new SlashCommandBuilder()
      .setName(this.getName())
      .setDescription("Refresh commands")
      .setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers);
      }

      public async execute(msg: ChatInputCommandInteraction<CacheType>) {
      await msg.deferReply();
      await this.bot.refreshCommands();
      await msg.editReply("Refreshed commands");
      }
      }
    • Start the bot.

      Returns Promise<void>

    • Checks to see if a user is in any of the servers this bot is in.

      Parameters

      • id: string

        User id

      Returns boolean

      If the user is in a server

      It is recommended to only use this if this bot is only in one server.