Fixed addcalendar, added other file stubs
This commit is contained in:
parent
dce3b6ecc4
commit
30a2114ff4
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
.env
|
||||
config.json
|
||||
node_modules
|
||||
node_modules
|
||||
keyfile.json
|
@ -17,8 +17,14 @@ async function main() {
|
||||
auth: jwtClient,
|
||||
});
|
||||
|
||||
const response = calendar.calendarList.list({});
|
||||
console.log('Output: ' + response.data);
|
||||
calendar.calendarList.list({}, (err, res) => {
|
||||
if (err) {
|
||||
console.log('[ERROR]');
|
||||
console.log(err.errors);
|
||||
return;
|
||||
}
|
||||
console.log(res.data.items.map(x => x.summary));
|
||||
});
|
||||
}
|
||||
|
||||
main().catch(e => {
|
||||
|
@ -1,6 +1,7 @@
|
||||
const { SlashCommandBuilder } = require('discord.js');
|
||||
const { google } = require('googleapis');
|
||||
const { googlePrivateKey, googleClientEmail, googleProjectNumber } = require('../../config.json');
|
||||
const { stdout } = require('node:process');
|
||||
const SCOPES = ['https://www.googleapis.com/auth/calendar'];
|
||||
|
||||
module.exports = {
|
||||
@ -20,11 +21,10 @@ module.exports = {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
|
||||
const name = interaction.options.getString('name');
|
||||
const description = interaction.options.getString('description');
|
||||
|
||||
const jwtClient = new google.auth.JWT(
|
||||
googleClientEmail,
|
||||
null,
|
||||
'./keyfile.json',
|
||||
googlePrivateKey,
|
||||
SCOPES,
|
||||
);
|
||||
@ -35,11 +35,21 @@ module.exports = {
|
||||
auth: jwtClient,
|
||||
});
|
||||
|
||||
calendar.calendarList.insert({
|
||||
'summary': name,
|
||||
'description': description,
|
||||
});
|
||||
|
||||
await interaction.editReply('New Calendar ' + name + ' Created');
|
||||
calendar.calendars.insert({
|
||||
resource: {
|
||||
summary: name,
|
||||
},
|
||||
},
|
||||
// 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