mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 00:24:07 -08:00
⚡ Implement current user operations
This commit is contained in:
parent
5a79894a2f
commit
08e3e2ee37
|
@ -6,8 +6,10 @@ import {
|
|||
const scopes = [
|
||||
'bot',
|
||||
'connections',
|
||||
'email',
|
||||
'guilds',
|
||||
'identify',
|
||||
'messages.read',
|
||||
'webhook.incoming',
|
||||
];
|
||||
|
||||
|
@ -44,7 +46,7 @@ export class DiscordOAuth2Api implements ICredentialType {
|
|||
displayName: 'Auth URI Query Parameters',
|
||||
name: 'authQueryParameters',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: 'permissions=104448',
|
||||
default: 'permissions=104600',
|
||||
},
|
||||
{
|
||||
displayName: 'Authentication',
|
||||
|
|
|
@ -544,7 +544,7 @@ export class Discord implements INodeType {
|
|||
|
||||
// https://discord.com/developers/docs/resources/user#get-current-user-guilds
|
||||
|
||||
const endpoint = '/users/@me@guilds';
|
||||
const endpoint = '/users/@me/guilds';
|
||||
responseData = await discordApiRequest.call(this, 'GET', endpoint);
|
||||
|
||||
} else if (operation === 'get') {
|
||||
|
@ -560,17 +560,6 @@ export class Discord implements INodeType {
|
|||
const endpoint = `/users/${userId}`;
|
||||
responseData = await discordApiRequest.call(this, 'GET', endpoint);
|
||||
|
||||
} else if (operation === 'updateCurrentUser') {
|
||||
|
||||
// ----------------------------------------
|
||||
// user: updateCurrentUser
|
||||
// ----------------------------------------
|
||||
|
||||
// https://discord.com/developers/docs/resources/user#modify-current-user
|
||||
|
||||
const endpoint = '/users/@me';
|
||||
responseData = await discordApiRequest.call(this, 'PATCH', endpoint);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ export async function discordApiRequest(
|
|||
console.log(options);
|
||||
return await this.helpers.requestOAuth2!.call(this, 'discordOAuth2Api', options, oAuth2Options);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
||||
// TODO: Prettify error
|
||||
|
||||
|
|
|
@ -27,10 +27,6 @@ export const userOperations = [
|
|||
name: 'Get',
|
||||
value: 'get',
|
||||
},
|
||||
{
|
||||
name: 'Update Current User',
|
||||
value: 'updateCurrentUser',
|
||||
},
|
||||
],
|
||||
default: 'getCurrentUser',
|
||||
description: 'Operation to perform',
|
||||
|
@ -39,9 +35,9 @@ export const userOperations = [
|
|||
|
||||
export const userFields = [
|
||||
{
|
||||
displayName: 'userId',
|
||||
displayName: 'User ID',
|
||||
name: 'userId',
|
||||
description: '',
|
||||
description: 'ID of the user to retrieve',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
|
@ -56,4 +52,4 @@ export const userFields = [
|
|||
},
|
||||
},
|
||||
},
|
||||
] as INodeProperties[];
|
||||
] as INodeProperties[];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export const auditLogEvents = [
|
||||
{
|
||||
name: 'Bot ADd',
|
||||
name: 'Bot Add',
|
||||
value: 28,
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue