mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 17:00:08 +00:00
* feat: Add return types to forum channel helpers. * fix: Use Discord-defined property names. Add `flags` property. * feat: Add return types to thread channel helpers. * feat: Add return types to channel helpers. * feat: Add return types to server discovery helpers. * misc!: Consistency: 'remove' -> 'delete'. * misc!: Add `get` keyword to function and file name. * feat: Add return types to emoji helpers. * misc!: Remove unused `bot` parameter. Capitalise 'URL'. * feat: Add return types to guild automod helpers. * feat: Add return types to guild scheduled event helpers. * misc!: Consistency: Rename `emojiURL` to `getEmojiURL`. * feat: Add return types to guild helpers. * misc!: Consistency: Add 'get' keyword to function and file names. * feat: Add return types to invite helpers. * feat: Add return types to integration helpers. * feat: Add return types to application command helpers. * feat: Add return types to followup message helpers. * feat: Add return types to interaction response helpers. * feat: Add return type to `createInvite()`. * feat: Add return types to member helpers. * misc!: Consistency: Add 'get' keyword to function and file names. * feat: Add return types to message helpers. * misc!: Consistency: 'remove' -> 'delete'. * fix: Use `slice()` to prevent unwanted side effects. * feat: Add return types to miscellaneous helpers. * misc!: Consistency: Add 'get' keyword to function and file names. * feat: Add return types to role helpers. * feat: Add return types to oauth helpers. * feat: Add return types to template helpers. * misc!: Consistency: Add 'guild' keyword to name. * feat: Add return types to voice helpers. * fix: Name function correctly. * feat: Add return types to webhook helpers. * misc!: Consistency: Rename `sendWebhook` to `sendWebhookMessage`. * misc: Update exports. * fix: Imports. * fix: Change return collection key type from `string` to `bigint`. Remove redundant code. * misc: Remove `undefined` from `runMethod()` return type. * style: Remove redundant types. * style: Rename endpoint call result variables to `result` and `results`. * misc: Reintroduce `bot` as first parameter. * misc: Adapt tests to changes made to helpers. * fix: Object being transformed twice. * style: Improve naming consistency of remaining files. * misc: `bigint` -> `number`. * style: Remove explicit `undefined` return. * style: Remove `void` operator in favour of generic type. * misc: Add missing `await` keyword. Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> * style: Make `reason` property optional instead of `undefined`-able. * misc: Write out properties manually instead of using the spread operator. Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import type { Bot } from "../../bot.ts";
|
|
import { Integration } from "../../transformers/integration.ts";
|
|
import { DiscordIntegration } from "../../types/discord.ts";
|
|
import { Collection } from "../../util/collection.ts";
|
|
|
|
/** Returns a list of integrations for the guild. Requires the MANAGE_GUILD permission. */
|
|
export async function getIntegrations(bot: Bot, guildId: bigint): Promise<Collection<bigint, Integration>> {
|
|
const results = await bot.rest.runMethod<DiscordIntegration[]>(
|
|
bot.rest,
|
|
"GET",
|
|
bot.constants.routes.GUILD_INTEGRATIONS(guildId),
|
|
);
|
|
|
|
return new Collection(
|
|
results.map((result) => {
|
|
const integration = bot.transformers.integration(bot, {
|
|
guild_id: guildId.toString(),
|
|
id: result.id,
|
|
name: result.name,
|
|
type: result.type,
|
|
enabled: result.enabled,
|
|
syncing: result.syncing,
|
|
role_id: result.role_id,
|
|
enable_emoticons: result.enable_emoticons,
|
|
expire_behavior: result.expire_behavior,
|
|
expire_grace_period: result.expire_grace_period,
|
|
user: result.user,
|
|
account: result.account,
|
|
synced_at: result.synced_at,
|
|
subscriber_count: result.subscriber_count,
|
|
revoked: result.revoked,
|
|
application: result.application,
|
|
});
|
|
return [integration.id, integration];
|
|
}),
|
|
);
|
|
}
|