feat(discord): use bot auth instead of user
This commit is contained in:
@@ -13,6 +13,7 @@ export default async function createAuthData($: IGlobalVariable) {
|
||||
client_id: $.auth.data.consumerKey as string,
|
||||
redirect_uri: callbackUrl,
|
||||
response_type: 'code',
|
||||
permissions: '2146958591',
|
||||
scope: scopes.join(' '),
|
||||
});
|
||||
|
||||
|
@@ -39,6 +39,18 @@ export default {
|
||||
description: null,
|
||||
docUrl: 'https://automatisch.io/docs/discord#consumer-secret',
|
||||
clickToCopy: false
|
||||
},
|
||||
{
|
||||
key: 'botToken',
|
||||
label: 'Bot token',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
placeholder: null,
|
||||
description: null,
|
||||
docUrl: 'https://automatisch.io/docs/discord#bot-token',
|
||||
clickToCopy: false
|
||||
}
|
||||
],
|
||||
authenticationSteps: [
|
||||
@@ -62,6 +74,10 @@ export default {
|
||||
{
|
||||
name: 'consumerSecret',
|
||||
value: '{fields.consumerSecret}'
|
||||
},
|
||||
{
|
||||
name: 'botToken',
|
||||
value: '{fields.botToken}'
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -154,6 +170,10 @@ export default {
|
||||
{
|
||||
name: 'consumerSecret',
|
||||
value: '{fields.consumerSecret}'
|
||||
},
|
||||
{
|
||||
name: 'botToken',
|
||||
value: '{fields.botToken}'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -28,6 +28,10 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
expires_in: expiresIn,
|
||||
scope: scope,
|
||||
token_type: tokenType,
|
||||
guild: {
|
||||
id: guildId,
|
||||
name: guildName,
|
||||
}
|
||||
} = verifiedCredentials;
|
||||
|
||||
await $.auth.set({
|
||||
@@ -44,6 +48,8 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
userId: user.id,
|
||||
screenName: user.username,
|
||||
email: user.email,
|
||||
guildId,
|
||||
guildName,
|
||||
});
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user