1. Packages
  2. Discord Provider
  3. API Docs
  4. Invite
discord 2.0.0 published on Friday, Mar 7, 2025 by lucky3028

discord.Invite

Explore with Pulumi AI

A resource to create an invite for a channel.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as discord from "@pulumi/discord";

const chatting = new discord.Invite("chatting", {
    channelId: _var.channel_id,
    maxAge: 0,
});
Copy
import pulumi
import pulumi_discord as discord

chatting = discord.Invite("chatting",
    channel_id=var["channel_id"],
    max_age=0)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/discord/v2/discord"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := discord.NewInvite(ctx, "chatting", &discord.InviteArgs{
			ChannelId: pulumi.Any(_var.Channel_id),
			MaxAge:    pulumi.Float64(0),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Discord = Pulumi.Discord;

return await Deployment.RunAsync(() => 
{
    var chatting = new Discord.Invite("chatting", new()
    {
        ChannelId = @var.Channel_id,
        MaxAge = 0,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.discord.Invite;
import com.pulumi.discord.InviteArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var chatting = new Invite("chatting", InviteArgs.builder()
            .channelId(var_.channel_id())
            .maxAge(0)
            .build());

    }
}
Copy
resources:
  chatting:
    type: discord:Invite
    properties:
      channelId: ${var.channel_id}
      maxAge: 0
Copy

Create Invite Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Invite(name: string, args: InviteArgs, opts?: CustomResourceOptions);
@overload
def Invite(resource_name: str,
           args: InviteArgs,
           opts: Optional[ResourceOptions] = None)

@overload
def Invite(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           channel_id: Optional[str] = None,
           max_age: Optional[float] = None,
           max_uses: Optional[float] = None,
           temporary: Optional[bool] = None,
           unique: Optional[bool] = None)
func NewInvite(ctx *Context, name string, args InviteArgs, opts ...ResourceOption) (*Invite, error)
public Invite(string name, InviteArgs args, CustomResourceOptions? opts = null)
public Invite(String name, InviteArgs args)
public Invite(String name, InviteArgs args, CustomResourceOptions options)
type: discord:Invite
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. InviteArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. InviteArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. InviteArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. InviteArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. InviteArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var inviteResource = new Discord.Invite("inviteResource", new()
{
    ChannelId = "string",
    MaxAge = 0,
    MaxUses = 0,
    Temporary = false,
    Unique = false,
});
Copy
example, err := discord.NewInvite(ctx, "inviteResource", &discord.InviteArgs{
ChannelId: pulumi.String("string"),
MaxAge: pulumi.Float64(0),
MaxUses: pulumi.Float64(0),
Temporary: pulumi.Bool(false),
Unique: pulumi.Bool(false),
})
Copy
var inviteResource = new Invite("inviteResource", InviteArgs.builder()
    .channelId("string")
    .maxAge(0)
    .maxUses(0)
    .temporary(false)
    .unique(false)
    .build());
Copy
invite_resource = discord.Invite("inviteResource",
    channel_id="string",
    max_age=0,
    max_uses=0,
    temporary=False,
    unique=False)
Copy
const inviteResource = new discord.Invite("inviteResource", {
    channelId: "string",
    maxAge: 0,
    maxUses: 0,
    temporary: false,
    unique: false,
});
Copy
type: discord:Invite
properties:
    channelId: string
    maxAge: 0
    maxUses: 0
    temporary: false
    unique: false
Copy

Invite Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Invite resource accepts the following input properties:

ChannelId This property is required. string
ID of the channel to create an invite for.
MaxAge double
Age of the invite. 0 for permanent. (default 86400)
MaxUses double
Max number of uses for the invite. 0 (the default) for unlimited.
Temporary bool
Whether the invite kicks users after they close Discord. (default false)
Unique bool
Whether this should create a new invite every time.
ChannelId This property is required. string
ID of the channel to create an invite for.
MaxAge float64
Age of the invite. 0 for permanent. (default 86400)
MaxUses float64
Max number of uses for the invite. 0 (the default) for unlimited.
Temporary bool
Whether the invite kicks users after they close Discord. (default false)
Unique bool
Whether this should create a new invite every time.
channelId This property is required. String
ID of the channel to create an invite for.
maxAge Double
Age of the invite. 0 for permanent. (default 86400)
maxUses Double
Max number of uses for the invite. 0 (the default) for unlimited.
temporary Boolean
Whether the invite kicks users after they close Discord. (default false)
unique Boolean
Whether this should create a new invite every time.
channelId This property is required. string
ID of the channel to create an invite for.
maxAge number
Age of the invite. 0 for permanent. (default 86400)
maxUses number
Max number of uses for the invite. 0 (the default) for unlimited.
temporary boolean
Whether the invite kicks users after they close Discord. (default false)
unique boolean
Whether this should create a new invite every time.
channel_id This property is required. str
ID of the channel to create an invite for.
max_age float
Age of the invite. 0 for permanent. (default 86400)
max_uses float
Max number of uses for the invite. 0 (the default) for unlimited.
temporary bool
Whether the invite kicks users after they close Discord. (default false)
unique bool
Whether this should create a new invite every time.
channelId This property is required. String
ID of the channel to create an invite for.
maxAge Number
Age of the invite. 0 for permanent. (default 86400)
maxUses Number
Max number of uses for the invite. 0 (the default) for unlimited.
temporary Boolean
Whether the invite kicks users after they close Discord. (default false)
unique Boolean
Whether this should create a new invite every time.

Outputs

All input properties are implicitly available as output properties. Additionally, the Invite resource produces the following output properties:

Code string
The invite code.
Id string
The provider-assigned unique ID for this managed resource.
Code string
The invite code.
Id string
The provider-assigned unique ID for this managed resource.
code String
The invite code.
id String
The provider-assigned unique ID for this managed resource.
code string
The invite code.
id string
The provider-assigned unique ID for this managed resource.
code str
The invite code.
id str
The provider-assigned unique ID for this managed resource.
code String
The invite code.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing Invite Resource

Get an existing Invite resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: InviteState, opts?: CustomResourceOptions): Invite
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        channel_id: Optional[str] = None,
        code: Optional[str] = None,
        max_age: Optional[float] = None,
        max_uses: Optional[float] = None,
        temporary: Optional[bool] = None,
        unique: Optional[bool] = None) -> Invite
func GetInvite(ctx *Context, name string, id IDInput, state *InviteState, opts ...ResourceOption) (*Invite, error)
public static Invite Get(string name, Input<string> id, InviteState? state, CustomResourceOptions? opts = null)
public static Invite get(String name, Output<String> id, InviteState state, CustomResourceOptions options)
resources:  _:    type: discord:Invite    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ChannelId string
ID of the channel to create an invite for.
Code string
The invite code.
MaxAge double
Age of the invite. 0 for permanent. (default 86400)
MaxUses double
Max number of uses for the invite. 0 (the default) for unlimited.
Temporary bool
Whether the invite kicks users after they close Discord. (default false)
Unique bool
Whether this should create a new invite every time.
ChannelId string
ID of the channel to create an invite for.
Code string
The invite code.
MaxAge float64
Age of the invite. 0 for permanent. (default 86400)
MaxUses float64
Max number of uses for the invite. 0 (the default) for unlimited.
Temporary bool
Whether the invite kicks users after they close Discord. (default false)
Unique bool
Whether this should create a new invite every time.
channelId String
ID of the channel to create an invite for.
code String
The invite code.
maxAge Double
Age of the invite. 0 for permanent. (default 86400)
maxUses Double
Max number of uses for the invite. 0 (the default) for unlimited.
temporary Boolean
Whether the invite kicks users after they close Discord. (default false)
unique Boolean
Whether this should create a new invite every time.
channelId string
ID of the channel to create an invite for.
code string
The invite code.
maxAge number
Age of the invite. 0 for permanent. (default 86400)
maxUses number
Max number of uses for the invite. 0 (the default) for unlimited.
temporary boolean
Whether the invite kicks users after they close Discord. (default false)
unique boolean
Whether this should create a new invite every time.
channel_id str
ID of the channel to create an invite for.
code str
The invite code.
max_age float
Age of the invite. 0 for permanent. (default 86400)
max_uses float
Max number of uses for the invite. 0 (the default) for unlimited.
temporary bool
Whether the invite kicks users after they close Discord. (default false)
unique bool
Whether this should create a new invite every time.
channelId String
ID of the channel to create an invite for.
code String
The invite code.
maxAge Number
Age of the invite. 0 for permanent. (default 86400)
maxUses Number
Max number of uses for the invite. 0 (the default) for unlimited.
temporary Boolean
Whether the invite kicks users after they close Discord. (default false)
unique Boolean
Whether this should create a new invite every time.

Import

$ pulumi import discord:index/invite:Invite example "<invite code>"
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
discord lucky3028/terraform-provider-discord
License
Notes
This Pulumi package is based on the discord Terraform Provider.