Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for Guild Scheduled Events #166

Closed
wants to merge 1 commit into from

Conversation

danbracey
Copy link

Please could this be reviewed and not blindly merged as not sure I've done what's needed here. When merged, this will resolve and close #165

Copy link
Author

@danbracey danbracey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments to explain code - Assistance requested please

/**
* the time the scheduled event will end, required if entity_type is EXTERNAL
*
* @var \DateTimeImmutable|null
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to docs this should be a ISO8601 timestamp, is this the correct var to use here?

*
* @var \DateTimeImmutable|null
*/
public $scheduled_start_time;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to docs this should be a ISO8601 timestamp, is this the correct var to use here?

@rampmaster
Copy link

ping @aequasi

@cryptiklemur
Copy link
Contributor

Can you please test the dev-v9 branch to see if the guild scheduled events work there?

@baticag
Copy link

baticag commented Dec 29, 2021

This would be great to see implemented

@LeigerGaming
Copy link

Would love to see this merged.

@cryptiklemur
Copy link
Contributor

Can you please test the dev-v9 branch to see if the guild scheduled events work there?

@LeigerGaming
Copy link

If I can work out how to specify that in composer.json, sure. Will take a look at it now.

@LeigerGaming
Copy link

Changed:

"restcord/restcord": "dev-develop",

Into this:

"restcord/restcord": "dev-v9",

And received the following error when attempting to update it:

Problem 1
    - Root composer.json requires restcord/restcord dev-v9, found restcord/restcord[dev-master, dev-develop, 0.1.0, ..., 0.5.0, v9.x-dev] but it does not match the constraint.

@LeigerGaming
Copy link

LeigerGaming commented Jan 7, 2022

Managed to get it to update with v9.x-dev instead.

However, this sample code seems invalid:

$client->guild-scheduled-event->getGuildScheduledEvent($parameters);

... as seen in "Get Guild Scheduled Event.md"

How is it supposed to be called? As guild-scheduled-event does not work. And any more sensible values I attempt (camelCase or snake_case variants of the same thing) report an error, e.g. "No category with the name: guild_scheduled_event"

@LeigerGaming
Copy link

It looks like there's a similar issue with the audit log stuff, i.e. #152

@LeigerGaming
Copy link

And if I modify service-description-v9.json so that it works without the hyphens, I can't actually get it to successfully create an event via the API:

$bot->guildscheduledevent->createGuildScheduledEvent([
    'guild.id' => $guildId,
    'name' => 'Testing',
]);

Error message:

There was an error executing the createGuildScheduledEvent command: Client error: `POST https://discord.com/api/v9/guilds/<snipped>/scheduled-events` resulted in a `400 Bad Request` response:
 (truncated...)

I've been unsuccessful in working out what the truncated part of the error message is.

@LeigerGaming
Copy link

LeigerGaming commented Jan 7, 2022

Also, if I do provide some of the optional fields, I run into validation errors - which I suspect are due to Restcord incorrectly defining the types of these parameters?

Validation errors: [entity_metadata] must be of type entity metadata
[privacy_level] must be of type privacy level
[scheduled_start_time] must be of type ISO8601 timestamp
[scheduled_end_time] must be of type ISO8601 timestamp
[entity_type] must be of type entity type

I'm pretty confident that I'm defining at least a few of these correctly :\

Here's my options array:

$bot->guildscheduledevent->createGuildScheduledEvent([
    'guild.id' => $guildId,
    'name' => 'Testing',
    'description' => 'This is a test description.',
    'scheduled_start_time' => Carbon::parse('8 January 2022 at 5pm')->toDateTimeImmutable(),
    'scheduled_end_time' => Carbon::parse('8 January 2022 at 7pm')->toDateTimeImmutable(),
    'privacy_level' => 2, // GUILD_ONLY
    'entity_type' => 3, // EXTERNAL
    'entity_metadata' => [
        'location' => 'https://example.com',
    ],
]);

@LeigerGaming
Copy link

I have found a solution for these issues and resolved it in #174

@SQKo
Copy link

SQKo commented Jul 19, 2022

Possibly Solved/Duplicate of #174

@danbracey danbracey closed this Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for discord Scheduled Events
6 participants