Viewing docs for discord 2.5.1
published on Thursday, Mar 19, 2026 by lucky3028
published on Thursday, Mar 19, 2026 by lucky3028
Viewing docs for discord 2.5.1
published on Thursday, Mar 19, 2026 by lucky3028
published on Thursday, Mar 19, 2026 by lucky3028
Fetches a role’s information from a server.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as discord from "@pulumi/discord";
const modsId = discord.getRole({
serverId: "81384788765712384",
roleId: "175643578071121920",
});
const modsName = discord.getRole({
serverId: "81384788765712384",
name: "Mods",
});
export const modsColor = modsId.then(modsId => modsId.color);
import pulumi
import pulumi_discord as discord
mods_id = discord.get_role(server_id="81384788765712384",
role_id="175643578071121920")
mods_name = discord.get_role(server_id="81384788765712384",
name="Mods")
pulumi.export("modsColor", mods_id.color)
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 {
modsId, err := discord.LookupRole(ctx, &discord.LookupRoleArgs{
ServerId: "81384788765712384",
RoleId: pulumi.StringRef("175643578071121920"),
}, nil)
if err != nil {
return err
}
_, err = discord.LookupRole(ctx, &discord.LookupRoleArgs{
ServerId: "81384788765712384",
Name: pulumi.StringRef("Mods"),
}, nil)
if err != nil {
return err
}
ctx.Export("modsColor", modsId.Color)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Discord = Pulumi.Discord;
return await Deployment.RunAsync(() =>
{
var modsId = Discord.GetRole.Invoke(new()
{
ServerId = "81384788765712384",
RoleId = "175643578071121920",
});
var modsName = Discord.GetRole.Invoke(new()
{
ServerId = "81384788765712384",
Name = "Mods",
});
return new Dictionary<string, object?>
{
["modsColor"] = modsId.Apply(getRoleResult => getRoleResult.Color),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.discord.DiscordFunctions;
import com.pulumi.discord.inputs.GetRoleArgs;
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) {
final var modsId = DiscordFunctions.getRole(GetRoleArgs.builder()
.serverId("81384788765712384")
.roleId("175643578071121920")
.build());
final var modsName = DiscordFunctions.getRole(GetRoleArgs.builder()
.serverId("81384788765712384")
.name("Mods")
.build());
ctx.export("modsColor", modsId.color());
}
}
variables:
modsId:
fn::invoke:
function: discord:getRole
arguments:
serverId: '81384788765712384'
roleId: '175643578071121920'
modsName:
fn::invoke:
function: discord:getRole
arguments:
serverId: '81384788765712384'
name: Mods
outputs:
modsColor: ${modsId.color}
Using getRole
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getRole(args: GetRoleArgs, opts?: InvokeOptions): Promise<GetRoleResult>
function getRoleOutput(args: GetRoleOutputArgs, opts?: InvokeOptions): Output<GetRoleResult>def get_role(name: Optional[str] = None,
role_id: Optional[str] = None,
server_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetRoleResult
def get_role_output(name: Optional[pulumi.Input[str]] = None,
role_id: Optional[pulumi.Input[str]] = None,
server_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetRoleResult]func LookupRole(ctx *Context, args *LookupRoleArgs, opts ...InvokeOption) (*LookupRoleResult, error)
func LookupRoleOutput(ctx *Context, args *LookupRoleOutputArgs, opts ...InvokeOption) LookupRoleResultOutput> Note: This function is named LookupRole in the Go SDK.
public static class GetRole
{
public static Task<GetRoleResult> InvokeAsync(GetRoleArgs args, InvokeOptions? opts = null)
public static Output<GetRoleResult> Invoke(GetRoleInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetRoleResult> getRole(GetRoleArgs args, InvokeOptions options)
public static Output<GetRoleResult> getRole(GetRoleArgs args, InvokeOptions options)
fn::invoke:
function: discord:index/getRole:getRole
arguments:
# arguments dictionaryThe following arguments are supported:
getRole Result
The following output properties are available:
- Color double
- The integer representation of the role's color with decimal color code.
- Hoist bool
- Whether the role is hoisted.
- Id string
- The ID of the role.
- Managed bool
- Whether the role is managed.
- Mentionable bool
- Whether the role is mentionable.
- Permissions double
- The permission bits of the role.
- Position double
- Position of the role. This is reverse-indexed, with
@everyonebeing0. - Server
Id string - The server ID to search for the user in.
- Name string
- The role name to search for. Either this or
role_idis required. - Role
Id string - The user ID to search for. Either this or
nameis required.
- Color float64
- The integer representation of the role's color with decimal color code.
- Hoist bool
- Whether the role is hoisted.
- Id string
- The ID of the role.
- Managed bool
- Whether the role is managed.
- Mentionable bool
- Whether the role is mentionable.
- Permissions float64
- The permission bits of the role.
- Position float64
- Position of the role. This is reverse-indexed, with
@everyonebeing0. - Server
Id string - The server ID to search for the user in.
- Name string
- The role name to search for. Either this or
role_idis required. - Role
Id string - The user ID to search for. Either this or
nameis required.
- color Double
- The integer representation of the role's color with decimal color code.
- hoist Boolean
- Whether the role is hoisted.
- id String
- The ID of the role.
- managed Boolean
- Whether the role is managed.
- mentionable Boolean
- Whether the role is mentionable.
- permissions Double
- The permission bits of the role.
- position Double
- Position of the role. This is reverse-indexed, with
@everyonebeing0. - server
Id String - The server ID to search for the user in.
- name String
- The role name to search for. Either this or
role_idis required. - role
Id String - The user ID to search for. Either this or
nameis required.
- color number
- The integer representation of the role's color with decimal color code.
- hoist boolean
- Whether the role is hoisted.
- id string
- The ID of the role.
- managed boolean
- Whether the role is managed.
- mentionable boolean
- Whether the role is mentionable.
- permissions number
- The permission bits of the role.
- position number
- Position of the role. This is reverse-indexed, with
@everyonebeing0. - server
Id string - The server ID to search for the user in.
- name string
- The role name to search for. Either this or
role_idis required. - role
Id string - The user ID to search for. Either this or
nameis required.
- color float
- The integer representation of the role's color with decimal color code.
- hoist bool
- Whether the role is hoisted.
- id str
- The ID of the role.
- managed bool
- Whether the role is managed.
- mentionable bool
- Whether the role is mentionable.
- permissions float
- The permission bits of the role.
- position float
- Position of the role. This is reverse-indexed, with
@everyonebeing0. - server_
id str - The server ID to search for the user in.
- name str
- The role name to search for. Either this or
role_idis required. - role_
id str - The user ID to search for. Either this or
nameis required.
- color Number
- The integer representation of the role's color with decimal color code.
- hoist Boolean
- Whether the role is hoisted.
- id String
- The ID of the role.
- managed Boolean
- Whether the role is managed.
- mentionable Boolean
- Whether the role is mentionable.
- permissions Number
- The permission bits of the role.
- position Number
- Position of the role. This is reverse-indexed, with
@everyonebeing0. - server
Id String - The server ID to search for the user in.
- name String
- The role name to search for. Either this or
role_idis required. - role
Id String - The user ID to search for. Either this or
nameis required.
Package Details
- Repository
- discord lucky3028/terraform-provider-discord
- License
- Notes
- This Pulumi package is based on the
discordTerraform Provider.
Viewing docs for discord 2.5.1
published on Thursday, Mar 19, 2026 by lucky3028
published on Thursday, Mar 19, 2026 by lucky3028
