Fixed addcalendar, added other file stubs
This commit is contained in:
parent
dce3b6ecc4
commit
30a2114ff4
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
.env
|
.env
|
||||||
config.json
|
config.json
|
||||||
node_modules
|
node_modules
|
||||||
|
keyfile.json
|
@ -17,8 +17,14 @@ async function main() {
|
|||||||
auth: jwtClient,
|
auth: jwtClient,
|
||||||
});
|
});
|
||||||
|
|
||||||
const response = calendar.calendarList.list({});
|
calendar.calendarList.list({}, (err, res) => {
|
||||||
console.log('Output: ' + response.data);
|
if (err) {
|
||||||
|
console.log('[ERROR]');
|
||||||
|
console.log(err.errors);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log(res.data.items.map(x => x.summary));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch(e => {
|
main().catch(e => {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const { SlashCommandBuilder } = require('discord.js');
|
const { SlashCommandBuilder } = require('discord.js');
|
||||||
const { google } = require('googleapis');
|
const { google } = require('googleapis');
|
||||||
const { googlePrivateKey, googleClientEmail, googleProjectNumber } = require('../../config.json');
|
const { googlePrivateKey, googleClientEmail, googleProjectNumber } = require('../../config.json');
|
||||||
|
const { stdout } = require('node:process');
|
||||||
const SCOPES = ['https://www.googleapis.com/auth/calendar'];
|
const SCOPES = ['https://www.googleapis.com/auth/calendar'];
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -20,11 +21,10 @@ module.exports = {
|
|||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
||||||
const name = interaction.options.getString('name');
|
const name = interaction.options.getString('name');
|
||||||
const description = interaction.options.getString('description');
|
|
||||||
|
|
||||||
const jwtClient = new google.auth.JWT(
|
const jwtClient = new google.auth.JWT(
|
||||||
googleClientEmail,
|
googleClientEmail,
|
||||||
null,
|
'./keyfile.json',
|
||||||
googlePrivateKey,
|
googlePrivateKey,
|
||||||
SCOPES,
|
SCOPES,
|
||||||
);
|
);
|
||||||
@ -35,11 +35,21 @@ module.exports = {
|
|||||||
auth: jwtClient,
|
auth: jwtClient,
|
||||||
});
|
});
|
||||||
|
|
||||||
calendar.calendarList.insert({
|
calendar.calendars.insert({
|
||||||
'summary': name,
|
resource: {
|
||||||
'description': description,
|
summary: name,
|
||||||
});
|
},
|
||||||
|
},
|
||||||
await interaction.editReply('New Calendar ' + name + ' Created');
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
async (err, res) => {
|
||||||
|
if (err) {
|
||||||
|
await interaction.editReply('Failed to create calendar ' + name + '\nAsk an Admin to check Breadbot console');
|
||||||
|
stdout.write('[ERROR]: ');
|
||||||
|
console.log(err.errors);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await interaction.editReply('New Calendar ' + name + ' Created');
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
0
commands/googlecalendar/addevent.js
Normal file
0
commands/googlecalendar/addevent.js
Normal file
0
commands/googlecalendar/deletecalendar.js
Normal file
0
commands/googlecalendar/deletecalendar.js
Normal file
0
commands/googlecalendar/deleteevent.js
Normal file
0
commands/googlecalendar/deleteevent.js
Normal file
0
commands/googlecalendar/listcalendar.js
Normal file
0
commands/googlecalendar/listcalendar.js
Normal file
0
commands/googlecalendar/listevents.js
Normal file
0
commands/googlecalendar/listevents.js
Normal file
0
commands/googlecalendar/modifyevent.js
Normal file
0
commands/googlecalendar/modifyevent.js
Normal file
Loading…
Reference in New Issue
Block a user