mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
6a53c2a375
Github issue / Community forum post (link here to close automatically): --------- Co-authored-by: Giulio Andreini <g.andreini@gmail.com> Co-authored-by: Marcus <marcus@n8n.io>
44 lines
757 B
TypeScript
44 lines
757 B
TypeScript
import type {
|
|
IAuthenticateGeneric,
|
|
ICredentialTestRequest,
|
|
ICredentialType,
|
|
INodeProperties,
|
|
} from 'n8n-workflow';
|
|
|
|
export class DiscordBotApi implements ICredentialType {
|
|
name = 'discordBotApi';
|
|
|
|
displayName = 'Discord Bot API';
|
|
|
|
documentationUrl = 'discord';
|
|
|
|
properties: INodeProperties[] = [
|
|
{
|
|
displayName: 'Bot Token',
|
|
name: 'botToken',
|
|
type: 'string',
|
|
default: '',
|
|
required: true,
|
|
typeOptions: {
|
|
password: true,
|
|
},
|
|
},
|
|
];
|
|
|
|
authenticate: IAuthenticateGeneric = {
|
|
type: 'generic',
|
|
properties: {
|
|
headers: {
|
|
Authorization: '=Bot {{$credentials.botToken}}',
|
|
},
|
|
},
|
|
};
|
|
|
|
test: ICredentialTestRequest = {
|
|
request: {
|
|
baseURL: 'https://discord.com/api/v10/',
|
|
url: '/users/@me/guilds',
|
|
},
|
|
};
|
|
}
|