Compare commits
1 Commits
decode-htm
...
AUT-770
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8e45a42a6b |
@@ -0,0 +1,120 @@
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Change a scheduled event',
|
||||
key: 'changeScheduledEvent',
|
||||
description: 'Changes a scheduled event',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Scheduled Event',
|
||||
key: 'scheduledEventId',
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
description: '',
|
||||
variables: false,
|
||||
source: {
|
||||
type: 'query',
|
||||
name: 'getDynamicData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
value: 'listScheduledEvents',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Status',
|
||||
key: 'status',
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
description:
|
||||
'After the status has been changed to COMPLETED or CANCELED, it becomes immutable and cannot be modified further.',
|
||||
variables: true,
|
||||
options: [
|
||||
{ label: 'SCHEDULED', value: 1 },
|
||||
{ label: 'ACTIVE', value: 2 },
|
||||
{ label: 'COMPLETED', value: 3 },
|
||||
{ label: 'CANCELED', value: 4 },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Type',
|
||||
key: 'entityType',
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
variables: true,
|
||||
options: [
|
||||
{ label: 'Stage channel', value: 1 },
|
||||
{ label: 'Voice channel', value: 2 },
|
||||
{ label: 'External', value: 3 },
|
||||
],
|
||||
additionalFields: {
|
||||
type: 'query',
|
||||
name: 'getDynamicFields',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
value: 'listScheduledEventFieldsForChange',
|
||||
},
|
||||
{
|
||||
name: 'parameters.entityType',
|
||||
value: '{parameters.entityType}',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Name',
|
||||
key: 'name',
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Description',
|
||||
key: 'description',
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Image',
|
||||
key: 'image',
|
||||
type: 'string',
|
||||
required: false,
|
||||
description:
|
||||
'Image as DataURI scheme [data:image/<jpeg/png/gif>;base64,BASE64_ENCODED_<JPEG/PNG/GIF>_IMAGE_DATA]',
|
||||
variables: true,
|
||||
},
|
||||
],
|
||||
|
||||
async run($) {
|
||||
const data = {
|
||||
channel_id: $.step.parameters.channel_id,
|
||||
name: $.step.parameters.name,
|
||||
scheduled_start_time: $.step.parameters.scheduledStartTime,
|
||||
scheduled_end_time: $.step.parameters.scheduledEndTime,
|
||||
description: $.step.parameters.description,
|
||||
entity_type: $.step.parameters.entityType,
|
||||
image: $.step.parameters.image,
|
||||
};
|
||||
|
||||
const isExternal = $.step.parameters.entityType === 3;
|
||||
|
||||
if (isExternal) {
|
||||
data.entity_metadata = {
|
||||
location: $.step.parameters.location,
|
||||
};
|
||||
|
||||
data.channel_id = null;
|
||||
}
|
||||
|
||||
const response = await $.http?.patch(
|
||||
`/guilds/${$.auth.data.guildId}/scheduled-events/${$.step.parameters.scheduledEventId}`,
|
||||
data
|
||||
);
|
||||
|
||||
$.setActionItem({ raw: response.data });
|
||||
},
|
||||
});
|
@@ -1,4 +1,9 @@
|
||||
import changeScheduledEvent from './change-scheduled-event/index.js';
|
||||
import sendMessageToChannel from './send-message-to-channel/index.js';
|
||||
import createScheduledEvent from './create-scheduled-event/index.js';
|
||||
|
||||
export default [sendMessageToChannel, createScheduledEvent];
|
||||
export default [
|
||||
changeScheduledEvent,
|
||||
sendMessageToChannel,
|
||||
createScheduledEvent,
|
||||
];
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import listChannels from './list-channels/index.js';
|
||||
import listScheduledEvents from './list-scheduled-events/index.js';
|
||||
import listVoiceChannels from './list-voice-channels/index.js';
|
||||
|
||||
export default [listChannels, listVoiceChannels];
|
||||
export default [listChannels, listScheduledEvents, listVoiceChannels];
|
||||
|
@@ -0,0 +1,24 @@
|
||||
export default {
|
||||
name: 'List scheduled events',
|
||||
key: 'listScheduledEvents',
|
||||
|
||||
async run($) {
|
||||
const scheduledEvents = {
|
||||
data: [],
|
||||
error: null,
|
||||
};
|
||||
|
||||
const response = await $.http.get(
|
||||
`/guilds/${$.auth.data.guildId}/scheduled-events`
|
||||
);
|
||||
|
||||
scheduledEvents.data = response.data.map((scheduledEvent) => {
|
||||
return {
|
||||
value: scheduledEvent.id,
|
||||
name: scheduledEvent.name,
|
||||
};
|
||||
});
|
||||
|
||||
return scheduledEvents;
|
||||
},
|
||||
};
|
@@ -1,3 +1,7 @@
|
||||
import listExternalScheduledEventFields from './list-external-scheduled-event-fields/index.js';
|
||||
import listScheduledEventFieldsForChange from './list-scheduled-event-fields-for-change/index.js';
|
||||
|
||||
export default [listExternalScheduledEventFields];
|
||||
export default [
|
||||
listExternalScheduledEventFields,
|
||||
listScheduledEventFieldsForChange,
|
||||
];
|
||||
|
@@ -0,0 +1,87 @@
|
||||
export default {
|
||||
name: 'List scheduled event fields for change',
|
||||
key: 'listScheduledEventFieldsForChange',
|
||||
|
||||
async run($) {
|
||||
const isExternal = $.step.parameters.entityType === 3;
|
||||
|
||||
if (isExternal) {
|
||||
return [
|
||||
{
|
||||
label: 'Location',
|
||||
key: 'location',
|
||||
type: 'string',
|
||||
required: true,
|
||||
description:
|
||||
'The location of the event (1-100 characters). This will be omitted if type is NOT EXTERNAL',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Start-Time',
|
||||
key: 'scheduledStartTime',
|
||||
type: 'string',
|
||||
required: false,
|
||||
description: 'The time the event will start [ISO8601]',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'End-Time',
|
||||
key: 'scheduledEndTime',
|
||||
type: 'string',
|
||||
required: true,
|
||||
description:
|
||||
'The time the event will end [ISO8601]. This will be omitted if type is NOT EXTERNAL',
|
||||
variables: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
label: 'Channel',
|
||||
key: 'channel_id',
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
description:
|
||||
'Pick a voice or stage channel to link the event to. This will be omitted if type is EXTERNAL',
|
||||
variables: true,
|
||||
source: {
|
||||
type: 'query',
|
||||
name: 'getDynamicData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
value: 'listVoiceChannels',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Location',
|
||||
key: 'location',
|
||||
type: 'string',
|
||||
required: false,
|
||||
description:
|
||||
'The location of the event (1-100 characters). This will be omitted if type is NOT EXTERNAL',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Start-Time',
|
||||
key: 'scheduledStartTime',
|
||||
type: 'string',
|
||||
required: false,
|
||||
description: 'The time the event will start [ISO8601]',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'End-Time',
|
||||
key: 'scheduledEndTime',
|
||||
type: 'string',
|
||||
required: false,
|
||||
description:
|
||||
'The time the event will end [ISO8601]. This will be omitted if type is NOT EXTERNAL',
|
||||
variables: true,
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
@@ -1,6 +1,8 @@
|
||||
---
|
||||
favicon: /favicons/discord.svg
|
||||
items:
|
||||
- name: Change a scheduled event
|
||||
desc: Changes a scheduled event.
|
||||
- name: Send a message to channel
|
||||
desc: Sends a message to a specific channel you specify.
|
||||
- name: Create a scheduled event
|
||||
|
Reference in New Issue
Block a user