Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/discord

src/index.ts

49 lines · 1.3 KB · TypeScript
import {
	BOT_INSTALL_URL,
	BOT_SECRET_SETUP_URL,
	DISCORD_API_BASE_URL,
	DISCORD_HOST,
	OAUTH_CONNECT_URL,
} from './errors.ts'
import { DEFAULT_BOT_SECRET_NAME, DEFAULT_OAUTH_INTEGRATION } from './validation.ts'

/** Describe the Discord helpers package, both auth lanes, and setup URLs. */
export default async function discordOverview() {
	return {
		package: '@kody/discord',
		apiBaseUrl: DISCORD_API_BASE_URL,
		host: DISCORD_HOST,
		lanes: {
			bot: {
				useFor: 'Read and post in servers, reactions, and threads.',
				secretName: DEFAULT_BOT_SECRET_NAME,
				authorization: 'Bot <token>',
				setupUrl: BOT_SECRET_SETUP_URL,
				installUrl: BOT_INSTALL_URL,
			},
			oauth: {
				useFor: 'User identity and the authorizing user\'s guild list. Cannot read channel messages.',
				integration: DEFAULT_OAUTH_INTEGRATION,
				scopes: ['identify', 'guilds'],
				setupUrl: OAUTH_CONNECT_URL,
			},
		},
		exports: [
			'smoke-test',
			'get-me',
			'list-guilds',
			'post-message',
			'edit-message',
			'fetch-channel',
			'fetch-channel-messages',
			'add-reaction',
			'create-thread',
			'list-channel-threads',
		],
		safety: {
			mutationsRequireConfirm: true,
			dryRunAvailable: true,
			multiAccount: 'Pass integration for OAuth and secretName for additional bot tokens.',
		},
	}
}