import { Plugin, PluginAPI } from '@ayanaware/bento'; import { ActivityPartial, BotActivityType, Message } from 'eris'; import type { LocalizedEmbedBuilder } from './builders/LocalizedEmbedBuilder'; import type { AnyCommandContext } from './commands/CommandContext'; import type { Command } from './commands/interfaces/Command'; import type { CommandPermissionDefaults } from './commands/interfaces/CommandDefinition'; import { DiscordPermission } from './discord/constants/DiscordPermission'; import type { MessageLocation } from './interfaces/MessageLocation'; import { PermissionScope } from './interfaces/PermissionScope'; export interface ShardData { /** shardIds, currently MUST be sorted & consecutive. 0, 1, 2. NOT 0, 2, 42 */ shardIds: Array; /** shard count */ shardCount: number; } export declare class BentocordInterface implements Plugin { name: string; api: PluginAPI; replaceable: boolean; protected readonly owners: string; protected readonly prefixes: Map; protected readonly permissions: Map; protected activity: ActivityPartial; /** * Used to determine what shards this process controls. * @returns Shard Data */ getShardData(): Promise; /** * Check if userId is a bot owner. * @param userId Discord User ID * @returns boolean */ isOwner(userId: string): Promise; getHelpEmbed(embed: LocalizedEmbedBuilder): Promise; /** * Default & Required selfPermissions for command * @param command Command * @param ctx AnyCommandContext * @returns Array */ selfPermissions(command: Command, ctx: AnyCommandContext): Promise>; /** * Allow's for domain-specific disabling of commands based on context. * Useful for many things, but not limited to: * - Disable free instance when paid instance is in the server * - Simple blacklist functionality * - Literally anything else you might want to check before running a command * @param command Command * @param ctx CommandContext * @returns boolean Whether or not to continue execution of command */ checkCommand(command: Command, ctx: AnyCommandContext): Promise; /** * Get the prefix for a given snowflake (ex: guildId). * @param snowflake The snowflake * @returns The prefix */ getPrefix(snowflake: string): Promise; /** * Set the prefix for a given snowflake. * @param snowflake The snowflake * @param prefix The prefix */ setPrefix(snowflake: string, prefix: string): Promise; /** Extra ALWAYS available prefixes */ getExtraPrefixes(): Promise>; resolveAlias(name: string, args: string, message: Message): Promise>; formatNumber(num: number, ctx?: Record): Promise; formatDate(date: Date, ctx?: Record): Promise; /** * Get locale code for a given context. * @param ctx Translation Context (Snowflakes) * @returns Locale Code */ getLocale(ctx: Record): Promise; /** * Format a translation string * @param key Translation key * @param repl Translation Replacements * @param ctx Translation Context (Snowflakes) * @param backup Translation Backup * @returns Translated string */ formatTranslation(key: string, repl?: Record, ctx?: Record, backup?: string): Promise; /** * Format a translation in all available languages. * @param key Translation Key * @param repl Translation Replacements * @returns Object, key is language, value is translation */ formatTranslationMap(key: string, repl?: Record): Promise>; /** * Can be used to convert translations to only the subset that discord supports * @param translations Translation Map from formatTranslationMap * @returns Converted Translation Map */ convertTranslationMap(translations: Record): Promise>; /** * Get the permission for a given snowflake. * @param permission The permission to check. * @param snowflake The snowflake to check (usually guildId or userId) * @param scope The scope to check. * @returns Whether the permission is allowed. */ getPermission(permission: string, snowflake?: string, scope?: PermissionScope): Promise; /** * Set the permission for a given snowflake. * @param permission The permission to set. * @param value Whether the permission is allowed. * @param snowflake The snowflake to set (usually guildId or userId) * @param scope The scope to set. */ setPermission(permission: string, value: boolean, snowflake?: string, scope?: PermissionScope): Promise; /** * Find permission override for a given context (guild, channel, user) * @param permission Permission to check * @param snowflakes Snowflakes of the context * @returns Tuple with [state, where] boolean if explicitly set, otherwise null */ findPermission(permission: string, snowflakes?: MessageLocation): Promise<[boolean, string]>; /** * Check if ctx has a given permission. * @param ctx CommandContext * @param perm Permission * @param def Permission defaults * @returns Whether context has the provided permission. */ checkPermission(ctx: AnyCommandContext, perm: string | Array, def?: CommandPermissionDefaults | boolean): Promise; }