You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

creating-guild-events.md 1.9 kB

12345678910111213141516171819202122232425262728293031
  1. ---
  2. uid: Guides.GuildEvents.Creating
  3. title: Creating Guild Events
  4. ---
  5. # Creating guild events
  6. You can create new guild events by using the `CreateEventAsync` function on a guild.
  7. ### Parameters
  8. | Name | Type | Summary |
  9. | ------------- | --------------------------------- | ---------------------------------------------------------------------------- |
  10. | name | `string` | Sets the name of the event. |
  11. | startTime | `DateTimeOffset` | Sets the start time of the event. |
  12. | type | `GuildScheduledEventType` | Sets the type of the event. |
  13. | privacyLevel? | `GuildScheduledEventPrivacyLevel` | Sets the privacy level of the event |
  14. | description? | `string` | Sets the description of the event. |
  15. | endTime? | `DateTimeOffset?` | Sets the end time of the event. |
  16. | channelId? | `ulong?` | Sets the channel id of the event, only valid on stage or voice channel types |
  17. | location? | `string` | Sets the location of the event, only valid on external types |
  18. Lets create a basic test event.
  19. ```cs
  20. var guild = client.GetGuild(guildId);
  21. var guildEvent = await guild.CreateEventAsync("test event", DateTimeOffset.UtcNow.AddDays(1), GuildScheduledEventType.External, endTime: DateTimeOffset.UtcNow.AddDays(2), location: "Space");
  22. ```
  23. This code will create an event that lasts a day and starts tomorrow. It will be an external event thats in space.