mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
chore: Migrate ESLint and prettier to Biome (#3634)
* Migrate eslint and prettier to biomejs This does NOT include examples/bigbot as it has its own formatter * Update to biome 1.8.0 * Readd dotenv dev dependency to rest During a merge it got lost
This commit is contained in:
@@ -18,8 +18,8 @@
|
||||
"build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js",
|
||||
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types",
|
||||
"release-build": "yarn build && yarn build:type",
|
||||
"fmt": "eslint --fix \"src/**/*.ts*\"",
|
||||
"lint": "eslint \"src/**/*.ts*\"",
|
||||
"fmt": "biome format --write",
|
||||
"lint": "biome lint --write",
|
||||
"test:unit-coverage": "c8 mocha --no-warnings 'tests/unit/**/*.spec.ts'",
|
||||
"test:unit": "c8 --r lcov mocha --no-warnings 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js discordeno",
|
||||
"test:deno-unit": "swc tests --strip-leading-paths --delete-dir-on-start --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist/unit",
|
||||
@@ -35,6 +35,7 @@
|
||||
"@discordeno/utils": "19.0.0-beta.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^1.8.0",
|
||||
"@swc/cli": "^0.4.0",
|
||||
"@swc/core": "^1.4.2",
|
||||
"@types/chai": "^4.3.16",
|
||||
@@ -43,8 +44,6 @@
|
||||
"@types/sinon": "^17.0.3",
|
||||
"c8": "^9.1.0",
|
||||
"chai": "^5.1.1",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-discordeno": "*",
|
||||
"mocha": "^10.5.1",
|
||||
"sinon": "^18.0.0",
|
||||
"ts-node": "^10.9.2",
|
||||
|
||||
@@ -3,10 +3,10 @@ import { ShardSocketCloseCodes, createGatewayManager } from '@discordeno/gateway
|
||||
import type { CreateRestManagerOptions, RestManager } from '@discordeno/rest'
|
||||
import { createRestManager } from '@discordeno/rest'
|
||||
import type { BigString, DiscordGatewayPayload, DiscordReady, GatewayIntents } from '@discordeno/types'
|
||||
import { createLogger, getBotIdFromToken, type Collection, type logger } from '@discordeno/utils'
|
||||
import { type Collection, createLogger, getBotIdFromToken, type logger } from '@discordeno/utils'
|
||||
import { createBotGatewayHandlers } from './handlers.js'
|
||||
import { createBotHelpers, type BotHelpers } from './helpers.js'
|
||||
import { createTransformers, type Transformers } from './transformers.js'
|
||||
import { type BotHelpers, createBotHelpers } from './helpers.js'
|
||||
import { type Transformers, createTransformers } from './transformers.js'
|
||||
import type { ApplicationCommandPermission } from './transformers/applicationCommandPermission.js'
|
||||
import type { AuditLogEntry } from './transformers/auditLogEntry.js'
|
||||
import type { AutoModerationActionExecution } from './transformers/automodActionExecution.js'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Bot, DiscordChannel, DiscordGatewayPayload } from '../../index.js'
|
||||
|
||||
export async function handleChannelCreate(bot: Bot, payload: DiscordGatewayPayload, shardId: number): Promise<void> {
|
||||
export async function handleChannelCreate(bot: Bot, payload: DiscordGatewayPayload, _shardId: number): Promise<void> {
|
||||
if (!bot.events.channelCreate) return
|
||||
|
||||
const data = payload.d as DiscordChannel
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { DiscordGatewayPayload, DiscordThreadMembersUpdate } from '@discordeno/types'
|
||||
import type { Bot } from '../../index.js'
|
||||
|
||||
export async function handleThreadMembersUpdate(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> {
|
||||
export async function handleThreadMembersUpdate(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
|
||||
if (!bot.events.threadMembersUpdate) return
|
||||
|
||||
const payload = data.d as DiscordThreadMembersUpdate
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { DiscordGatewayPayload, DiscordThreadMemberUpdate } from '@discordeno/types'
|
||||
import type { Bot } from '../../index.js'
|
||||
|
||||
export async function handleThreadMemberUpdate(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> {
|
||||
export async function handleThreadMemberUpdate(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
|
||||
if (!bot.events.threadMemberUpdate) return
|
||||
|
||||
const payload = data.d as DiscordThreadMemberUpdate
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Bot, DiscordGatewayPayload, DiscordGuildStickersUpdate } from '../../index.js'
|
||||
|
||||
export async function handleGuildStickersUpdate(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> {
|
||||
export async function handleGuildStickersUpdate(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
|
||||
if (!bot.events.guildStickersUpdate) return
|
||||
|
||||
const payload = data.d as DiscordGuildStickersUpdate
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { DiscordAutoModerationActionExecution, DiscordGatewayPayload } from
|
||||
import type { Bot } from '../../../bot.js'
|
||||
|
||||
/** Requires the MANAGE_GUILD permission. */
|
||||
export async function handleAutoModerationActionExecution(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> {
|
||||
export async function handleAutoModerationActionExecution(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
|
||||
if (!bot.events.automodActionExecution) return
|
||||
|
||||
const payload = data.d as DiscordAutoModerationActionExecution
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { DiscordAutoModerationRule, DiscordGatewayPayload } from '@discorde
|
||||
import type { Bot } from '../../../bot.js'
|
||||
|
||||
/** Requires the MANAGE_GUILD permission. */
|
||||
export async function handleAutoModerationRuleCreate(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> {
|
||||
export async function handleAutoModerationRuleCreate(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
|
||||
if (!bot.events.automodRuleCreate) return
|
||||
|
||||
const payload = data.d as DiscordAutoModerationRule
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { DiscordAutoModerationRule, DiscordGatewayPayload } from '@discorde
|
||||
import type { Bot } from '../../../bot.js'
|
||||
|
||||
/** Requires the MANAGE_GUILD permission. */
|
||||
export async function handleAutoModerationRuleDelete(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> {
|
||||
export async function handleAutoModerationRuleDelete(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
|
||||
if (!bot.events.automodRuleDelete) return
|
||||
|
||||
const payload = data.d as DiscordAutoModerationRule
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { DiscordAutoModerationRule, DiscordGatewayPayload } from '@discorde
|
||||
import type { Bot } from '../../../bot.js'
|
||||
|
||||
/** Requires the MANAGE_GUILD permission. */
|
||||
export async function handleAutoModerationRuleUpdate(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> {
|
||||
export async function handleAutoModerationRuleUpdate(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
|
||||
if (!bot.events.automodRuleUpdate) return
|
||||
|
||||
const payload = data.d as DiscordAutoModerationRule
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { DiscordGatewayPayload, DiscordScheduledEvent } from '@discordeno/types'
|
||||
import type { Bot } from '../../../bot.js'
|
||||
|
||||
export async function handleGuildScheduledEventCreate(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> {
|
||||
export async function handleGuildScheduledEventCreate(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
|
||||
if (!bot.events.scheduledEventCreate) return
|
||||
|
||||
const payload = data.d as DiscordScheduledEvent
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Bot, DiscordGatewayPayload, DiscordGuildApplicationCommandPermissions } from '../../index.js'
|
||||
|
||||
export async function handleApplicationCommandPermissionsUpdate(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> {
|
||||
export async function handleApplicationCommandPermissionsUpdate(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
|
||||
if (!bot.events.applicationCommandPermissionsUpdate) return
|
||||
|
||||
const payload = data.d as DiscordGuildApplicationCommandPermissions
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { DiscordGatewayPayload, DiscordWebhookUpdate } from '@discordeno/types'
|
||||
import type { Bot } from '../../index.js'
|
||||
|
||||
export async function handleWebhooksUpdate(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> {
|
||||
export async function handleWebhooksUpdate(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
|
||||
if (!bot.events.webhooksUpdate) return
|
||||
|
||||
const payload = data.d as DiscordWebhookUpdate
|
||||
|
||||
@@ -69,8 +69,8 @@ import type {
|
||||
GetInvite,
|
||||
GetMessagesOptions,
|
||||
GetReactions,
|
||||
GetScheduledEvents,
|
||||
GetScheduledEventUsers,
|
||||
GetScheduledEvents,
|
||||
GetUserGuilds,
|
||||
GetWebhookMessageOptions,
|
||||
InteractionCallbackData,
|
||||
|
||||
@@ -14,7 +14,7 @@ export type Optionalize<T> = T extends object
|
||||
? T extends unknown[]
|
||||
? number extends T['length']
|
||||
? T[number] extends object
|
||||
? Array<OptionalizeAux<T[number]>>
|
||||
? OptionalizeAux<T[number]>[]
|
||||
: T
|
||||
: Partial<T>
|
||||
: OptionalizeAux<T>
|
||||
|
||||
@@ -55,25 +55,26 @@ import type {
|
||||
DiscordWelcomeScreen,
|
||||
} from '@discordeno/types'
|
||||
import { logger } from '@discordeno/utils'
|
||||
import { bigintToSnowflake, snowflakeToBigint, type Bot } from './index.js'
|
||||
import { transformActivity, type Activity } from './transformers/activity.js'
|
||||
import { transformApplication, type Application } from './transformers/application.js'
|
||||
import { transformApplicationCommand, type ApplicationCommand } from './transformers/applicationCommand.js'
|
||||
import { transformApplicationCommandOption, type ApplicationCommandOption } from './transformers/applicationCommandOption.js'
|
||||
import { transformApplicationCommandOptionChoice, type ApplicationCommandOptionChoice } from './transformers/applicationCommandOptionChoice.js'
|
||||
import { transformApplicationCommandPermission, type ApplicationCommandPermission } from './transformers/applicationCommandPermission.js'
|
||||
import { transformAttachment, type Attachment } from './transformers/attachment.js'
|
||||
import { transformAuditLogEntry, type AuditLogEntry } from './transformers/auditLogEntry.js'
|
||||
import { transformAutoModerationActionExecution, type AutoModerationActionExecution } from './transformers/automodActionExecution.js'
|
||||
import { transformAutoModerationRule, type AutoModerationRule } from './transformers/automodRule.js'
|
||||
import { transformChannel, transformForumTag, type Channel, type ForumTag } from './transformers/channel.js'
|
||||
import { transformComponent, type Component } from './transformers/component.js'
|
||||
import { transformEmbed, type Embed } from './transformers/embed.js'
|
||||
import { transformDefaultReactionEmoji, transformEmoji, type DefaultReactionEmoji, type Emoji } from './transformers/emoji.js'
|
||||
import { transformEntitlement, type Entitlement } from './transformers/entitlement.js'
|
||||
import { transformGatewayBot, type GetGatewayBot } from './transformers/gatewayBot.js'
|
||||
import { transformGuild, type Guild } from './transformers/guild.js'
|
||||
import { type Bot, bigintToSnowflake, snowflakeToBigint } from './index.js'
|
||||
import { type Activity, transformActivity } from './transformers/activity.js'
|
||||
import { type Application, transformApplication } from './transformers/application.js'
|
||||
import { type ApplicationCommand, transformApplicationCommand } from './transformers/applicationCommand.js'
|
||||
import { type ApplicationCommandOption, transformApplicationCommandOption } from './transformers/applicationCommandOption.js'
|
||||
import { type ApplicationCommandOptionChoice, transformApplicationCommandOptionChoice } from './transformers/applicationCommandOptionChoice.js'
|
||||
import { type ApplicationCommandPermission, transformApplicationCommandPermission } from './transformers/applicationCommandPermission.js'
|
||||
import { type Attachment, transformAttachment } from './transformers/attachment.js'
|
||||
import { type AuditLogEntry, transformAuditLogEntry } from './transformers/auditLogEntry.js'
|
||||
import { type AutoModerationActionExecution, transformAutoModerationActionExecution } from './transformers/automodActionExecution.js'
|
||||
import { type AutoModerationRule, transformAutoModerationRule } from './transformers/automodRule.js'
|
||||
import { type Channel, type ForumTag, transformChannel, transformForumTag } from './transformers/channel.js'
|
||||
import { type Component, transformComponent } from './transformers/component.js'
|
||||
import { type Embed, transformEmbed } from './transformers/embed.js'
|
||||
import { type DefaultReactionEmoji, type Emoji, transformDefaultReactionEmoji, transformEmoji } from './transformers/emoji.js'
|
||||
import { type Entitlement, transformEntitlement } from './transformers/entitlement.js'
|
||||
import { type GetGatewayBot, transformGatewayBot } from './transformers/gatewayBot.js'
|
||||
import { type Guild, transformGuild } from './transformers/guild.js'
|
||||
import {
|
||||
type AvatarDecorationData,
|
||||
transformActivityToDiscordActivity,
|
||||
transformApplicationCommandOptionChoiceToDiscordApplicationCommandOptionChoice,
|
||||
transformApplicationCommandOptionToDiscordApplicationCommandOption,
|
||||
@@ -86,47 +87,46 @@ import {
|
||||
transformMemberToDiscordMember,
|
||||
transformTeamToDiscordTeam,
|
||||
transformUserToDiscordUser,
|
||||
type AvatarDecorationData,
|
||||
} from './transformers/index.js'
|
||||
import { transformIntegration, type Integration } from './transformers/integration.js'
|
||||
import { transformInteraction, transformInteractionDataOption, type Interaction, type InteractionDataOption } from './transformers/interaction.js'
|
||||
import { transformInvite, type Invite } from './transformers/invite.js'
|
||||
import { transformMember, type Member } from './transformers/member.js'
|
||||
import { type Integration, transformIntegration } from './transformers/integration.js'
|
||||
import { type Interaction, type InteractionDataOption, transformInteraction, transformInteractionDataOption } from './transformers/interaction.js'
|
||||
import { type Invite, transformInvite } from './transformers/invite.js'
|
||||
import { type Member, transformMember } from './transformers/member.js'
|
||||
import {
|
||||
transformMessage,
|
||||
transformMessageCall,
|
||||
transformMessageInteractionMetadata,
|
||||
type Message,
|
||||
type MessageCall,
|
||||
type MessageInteractionMetadata,
|
||||
transformMessage,
|
||||
transformMessageCall,
|
||||
transformMessageInteractionMetadata,
|
||||
} from './transformers/message.js'
|
||||
import { transformGuildOnboarding, type GuildOnboarding } from './transformers/onboarding.js'
|
||||
import { transformPoll, transformPollMedia, type Poll, type PollMedia } from './transformers/poll.js'
|
||||
import { transformPresence, type PresenceUpdate } from './transformers/presence.js'
|
||||
import { type GuildOnboarding, transformGuildOnboarding } from './transformers/onboarding.js'
|
||||
import { type Poll, type PollMedia, transformPoll, transformPollMedia } from './transformers/poll.js'
|
||||
import { type PresenceUpdate, transformPresence } from './transformers/presence.js'
|
||||
import { transformAllowedMentionsToDiscordAllowedMentions } from './transformers/reverse/allowedMentions.js'
|
||||
import { transformCreateApplicationCommandToDiscordCreateApplicationCommand } from './transformers/reverse/createApplicationCommand.js'
|
||||
import { transformInteractionResponseToDiscordInteractionResponse } from './transformers/reverse/interactionResponse.js'
|
||||
import { transformRole, type Role } from './transformers/role.js'
|
||||
import { transformScheduledEvent, type ScheduledEvent } from './transformers/scheduledEvent.js'
|
||||
import { transformSku, type Sku } from './transformers/sku.js'
|
||||
import { transformStageInstance, type StageInstance } from './transformers/stageInstance.js'
|
||||
import { transformInviteStageInstance, type InviteStageInstance } from './transformers/stageInviteInstance.js'
|
||||
import { transformSticker, transformStickerPack, type Sticker, type StickerPack } from './transformers/sticker.js'
|
||||
import { transformTeam, type Team } from './transformers/team.js'
|
||||
import { transformTemplate, type Template } from './transformers/template.js'
|
||||
import { type Role, transformRole } from './transformers/role.js'
|
||||
import { type ScheduledEvent, transformScheduledEvent } from './transformers/scheduledEvent.js'
|
||||
import { type Sku, transformSku } from './transformers/sku.js'
|
||||
import { type StageInstance, transformStageInstance } from './transformers/stageInstance.js'
|
||||
import { type InviteStageInstance, transformInviteStageInstance } from './transformers/stageInviteInstance.js'
|
||||
import { type Sticker, type StickerPack, transformSticker, transformStickerPack } from './transformers/sticker.js'
|
||||
import { type Team, transformTeam } from './transformers/team.js'
|
||||
import { type Template, transformTemplate } from './transformers/template.js'
|
||||
import {
|
||||
transformThreadMember,
|
||||
transformThreadMemberGuildCreate,
|
||||
type ThreadMember,
|
||||
type ThreadMemberGuildCreate,
|
||||
transformThreadMember,
|
||||
transformThreadMemberGuildCreate,
|
||||
} from './transformers/threadMember.js'
|
||||
import { transformUser, type User } from './transformers/user.js'
|
||||
import { transformVoiceRegion, type VoiceRegion } from './transformers/voiceRegion.js'
|
||||
import { transformVoiceState, type VoiceState } from './transformers/voiceState.js'
|
||||
import { transformWebhook, type Webhook } from './transformers/webhook.js'
|
||||
import { transformWelcomeScreen, type WelcomeScreen } from './transformers/welcomeScreen.js'
|
||||
import { transformWidget, type GuildWidget } from './transformers/widget.js'
|
||||
import { transformWidgetSettings, type GuildWidgetSettings } from './transformers/widgetSettings.js'
|
||||
import { type User, transformUser } from './transformers/user.js'
|
||||
import { type VoiceRegion, transformVoiceRegion } from './transformers/voiceRegion.js'
|
||||
import { type VoiceState, transformVoiceState } from './transformers/voiceState.js'
|
||||
import { type Webhook, transformWebhook } from './transformers/webhook.js'
|
||||
import { type WelcomeScreen, transformWelcomeScreen } from './transformers/welcomeScreen.js'
|
||||
import { type GuildWidget, transformWidget } from './transformers/widget.js'
|
||||
import { type GuildWidgetSettings, transformWidgetSettings } from './transformers/widgetSettings.js'
|
||||
import type { BotInteractionResponse, DiscordComponent, DiscordInteractionResponse, DiscordThreadMemberGuildCreate } from './typings.js'
|
||||
|
||||
export interface Transformers {
|
||||
@@ -689,154 +689,154 @@ export function createTransformers(options: Partial<Transformers>, opts?: Create
|
||||
|
||||
return {
|
||||
customizers: {
|
||||
channel(bot, payload, channel) {
|
||||
channel(_bot, _payload, channel) {
|
||||
return channel
|
||||
},
|
||||
forumTag(bot, payload, forumTag) {
|
||||
forumTag(_bot, _payload, forumTag) {
|
||||
return forumTag
|
||||
},
|
||||
interaction(bot, payload, interaction) {
|
||||
interaction(_bot, _payload, interaction) {
|
||||
return interaction
|
||||
},
|
||||
member(bot, payload, member) {
|
||||
member(_bot, _payload, member) {
|
||||
return member
|
||||
},
|
||||
message(bot, payload, message) {
|
||||
message(_bot, _payload, message) {
|
||||
return message
|
||||
},
|
||||
messageInteractionMetadata(bot, payload, metadata) {
|
||||
messageInteractionMetadata(_bot, _payload, metadata) {
|
||||
return metadata
|
||||
},
|
||||
messageCall(bot, payload, call) {
|
||||
messageCall(_bot, _payload, call) {
|
||||
return call
|
||||
},
|
||||
role(bot, payload, role) {
|
||||
role(_bot, _payload, role) {
|
||||
return role
|
||||
},
|
||||
user(bot, payload, user) {
|
||||
user(_bot, _payload, user) {
|
||||
return user
|
||||
},
|
||||
activity(bot, payload, activity) {
|
||||
activity(_bot, _payload, activity) {
|
||||
return activity
|
||||
},
|
||||
application(bot, payload, application) {
|
||||
application(_bot, _payload, application) {
|
||||
return application
|
||||
},
|
||||
applicationCommand(bot, payload, applicationCommand) {
|
||||
applicationCommand(_bot, _payload, applicationCommand) {
|
||||
return applicationCommand
|
||||
},
|
||||
applicationCommandOption(bot, payload, applicationCommandOption) {
|
||||
applicationCommandOption(_bot, _payload, applicationCommandOption) {
|
||||
return applicationCommandOption
|
||||
},
|
||||
applicationCommandOptionChoice(bot, payload, applicationCommandOptionChoice) {
|
||||
applicationCommandOptionChoice(_bot, _payload, applicationCommandOptionChoice) {
|
||||
return applicationCommandOptionChoice
|
||||
},
|
||||
applicationCommandPermission(bot, payload, applicationCommandPermission) {
|
||||
applicationCommandPermission(_bot, _payload, applicationCommandPermission) {
|
||||
return applicationCommandPermission
|
||||
},
|
||||
attachment(bot, payload, attachment) {
|
||||
attachment(_bot, _payload, attachment) {
|
||||
return attachment
|
||||
},
|
||||
auditLogEntry(bot, payload, auditLogEntry) {
|
||||
auditLogEntry(_bot, _payload, auditLogEntry) {
|
||||
return auditLogEntry
|
||||
},
|
||||
automodActionExecution(bot, payload, automodActionExecution) {
|
||||
automodActionExecution(_bot, _payload, automodActionExecution) {
|
||||
return automodActionExecution
|
||||
},
|
||||
automodRule(bot, payload, automodRule) {
|
||||
automodRule(_bot, _payload, automodRule) {
|
||||
return automodRule
|
||||
},
|
||||
component(bot, payload, component) {
|
||||
component(_bot, _payload, component) {
|
||||
return component
|
||||
},
|
||||
embed(bot, payload, embed) {
|
||||
embed(_bot, _payload, embed) {
|
||||
return embed
|
||||
},
|
||||
emoji(bot, payload, emoji) {
|
||||
emoji(_bot, _payload, emoji) {
|
||||
return emoji
|
||||
},
|
||||
defaultReactionEmoji(bot, payload, defaultReactionEmoji) {
|
||||
defaultReactionEmoji(_bot, _payload, defaultReactionEmoji) {
|
||||
return defaultReactionEmoji
|
||||
},
|
||||
guild(bot, payload, guild) {
|
||||
guild(_bot, _payload, guild) {
|
||||
return guild
|
||||
},
|
||||
integration(bot, payload, integration) {
|
||||
integration(_bot, _payload, integration) {
|
||||
return integration
|
||||
},
|
||||
interactionDataOptions(bot, payload, interactionDataOptions) {
|
||||
interactionDataOptions(_bot, _payload, interactionDataOptions) {
|
||||
return interactionDataOptions
|
||||
},
|
||||
invite(bot, payload, invite) {
|
||||
invite(_bot, _payload, invite) {
|
||||
return invite
|
||||
},
|
||||
presence(bot, payload, presence) {
|
||||
presence(_bot, _payload, presence) {
|
||||
return presence
|
||||
},
|
||||
scheduledEvent(bot, payload, scheduledEvent) {
|
||||
scheduledEvent(_bot, _payload, scheduledEvent) {
|
||||
return scheduledEvent
|
||||
},
|
||||
stageInstance(bot, payload, stageInstance) {
|
||||
stageInstance(_bot, _payload, stageInstance) {
|
||||
return stageInstance
|
||||
},
|
||||
inviteStageInstance(bot, payload, inviteStageInstance) {
|
||||
inviteStageInstance(_bot, _payload, inviteStageInstance) {
|
||||
return inviteStageInstance
|
||||
},
|
||||
sticker(bot, payload, sticker) {
|
||||
sticker(_bot, _payload, sticker) {
|
||||
return sticker
|
||||
},
|
||||
stickerPack(bot, payload, stickerPack) {
|
||||
stickerPack(_bot, _payload, stickerPack) {
|
||||
return stickerPack
|
||||
},
|
||||
team(bot, payload, team) {
|
||||
team(_bot, _payload, team) {
|
||||
return team
|
||||
},
|
||||
template(bot, payload, template) {
|
||||
template(_bot, _payload, template) {
|
||||
return template
|
||||
},
|
||||
threadMember(bot, payload, threadMember) {
|
||||
threadMember(_bot, _payload, threadMember) {
|
||||
return threadMember
|
||||
},
|
||||
threadMemberGuildCreate(bot, payload, threadMemberGuildCreate) {
|
||||
threadMemberGuildCreate(_bot, _payload, threadMemberGuildCreate) {
|
||||
return threadMemberGuildCreate
|
||||
},
|
||||
voiceRegion(bot, payload, voiceRegion) {
|
||||
voiceRegion(_bot, _payload, voiceRegion) {
|
||||
return voiceRegion
|
||||
},
|
||||
voiceState(bot, payload, voiceState) {
|
||||
voiceState(_bot, _payload, voiceState) {
|
||||
return voiceState
|
||||
},
|
||||
gatewayBot(bot, payload, getGatewayBot) {
|
||||
gatewayBot(_bot, _payload, getGatewayBot) {
|
||||
return getGatewayBot
|
||||
},
|
||||
webhook(bot, payload, webhook) {
|
||||
webhook(_bot, _payload, webhook) {
|
||||
return webhook
|
||||
},
|
||||
welcomeScreen(bot, payload, welcomeScreen) {
|
||||
welcomeScreen(_bot, _payload, welcomeScreen) {
|
||||
return welcomeScreen
|
||||
},
|
||||
widget(bot, payload, widget) {
|
||||
widget(_bot, _payload, widget) {
|
||||
return widget
|
||||
},
|
||||
widgetSettings(bot, payload, widgetSettings) {
|
||||
widgetSettings(_bot, _payload, widgetSettings) {
|
||||
return widgetSettings
|
||||
},
|
||||
guildOnboarding(bot, payload, onboarding) {
|
||||
guildOnboarding(_bot, _payload, onboarding) {
|
||||
return onboarding
|
||||
},
|
||||
entitlement(bot, payload, entitlement) {
|
||||
entitlement(_bot, _payload, entitlement) {
|
||||
return entitlement
|
||||
},
|
||||
sku(bot, payload, sku) {
|
||||
sku(_bot, _payload, sku) {
|
||||
return sku
|
||||
},
|
||||
poll(bot, payload, poll) {
|
||||
poll(_bot, _payload, poll) {
|
||||
return poll
|
||||
},
|
||||
pollMedia(bot, payload, pollMedia) {
|
||||
pollMedia(_bot, _payload, pollMedia) {
|
||||
return pollMedia
|
||||
},
|
||||
avatarDecorationData(bot, payload, avatarDecorationData) {
|
||||
avatarDecorationData(_bot, _payload, avatarDecorationData) {
|
||||
return avatarDecorationData
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import {
|
||||
DiscordApplicationIntegrationType,
|
||||
iconHashToBigInt,
|
||||
type ApplicationFlags,
|
||||
type Bot,
|
||||
type DiscordApplication,
|
||||
DiscordApplicationIntegrationType,
|
||||
type DiscordUser,
|
||||
type Guild,
|
||||
type OAuth2Scope,
|
||||
type Team,
|
||||
type User,
|
||||
iconHashToBigInt,
|
||||
} from '../index.js'
|
||||
|
||||
export function transformApplication(bot: Bot, payload: { application: DiscordApplication; shardId: number }): Application {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { AuditLogEvents, DiscordAuditLogEntry, OverwriteTypes } from '@discordeno/types'
|
||||
import { iconHashToBigInt, type Bot } from '../index.js'
|
||||
import { type Bot, iconHashToBigInt } from '../index.js'
|
||||
|
||||
export function transformAuditLogEntry(bot: Bot, payload: DiscordAuditLogEntry): AuditLogEntry {
|
||||
const auditLogEntry = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { iconHashToBigInt, type Bot, type DiscordAvatarDecorationData } from '../index.js'
|
||||
import { type Bot, type DiscordAvatarDecorationData, iconHashToBigInt } from '../index.js'
|
||||
|
||||
export function transformAvatarDecorationData(bot: Bot, payload: DiscordAvatarDecorationData): AvatarDecorationData {
|
||||
const data = {} as AvatarDecorationData
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import type {
|
||||
BigString,
|
||||
ChannelTypes,
|
||||
@@ -9,7 +8,7 @@ import type {
|
||||
SortOrderTypes,
|
||||
VideoQualityModes,
|
||||
} from '@discordeno/types'
|
||||
import { calculatePermissions, iconHashToBigInt, type Bot, type DefaultReactionEmoji, type ThreadMember, type User } from '../index.js'
|
||||
import { type Bot, type DefaultReactionEmoji, type ThreadMember, type User, calculatePermissions, iconHashToBigInt } from '../index.js'
|
||||
import { Permissions } from './toggles/Permissions.js'
|
||||
import { ChannelToggles } from './toggles/channel.js'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { DiscordIntegrationCreateUpdate, IntegrationExpireBehaviors, OAuth2Scope } from '@discordeno/types'
|
||||
import { iconHashToBigInt, type Bot, type User } from '../index.js'
|
||||
import { type Bot, type User, iconHashToBigInt } from '../index.js'
|
||||
|
||||
export function transformIntegration(bot: Bot, payload: DiscordIntegrationCreateUpdate): Integration {
|
||||
const integration = {
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import {
|
||||
InteractionResponseTypes,
|
||||
InteractionTypes,
|
||||
MessageFlags,
|
||||
type ApplicationCommandOptionTypes,
|
||||
type ApplicationCommandTypes,
|
||||
type BigString,
|
||||
@@ -9,14 +6,17 @@ import {
|
||||
type DiscordInteraction,
|
||||
type DiscordInteractionDataOption,
|
||||
type InteractionCallbackData,
|
||||
InteractionResponseTypes,
|
||||
InteractionTypes,
|
||||
type MessageComponentTypes,
|
||||
MessageFlags,
|
||||
} from '@discordeno/types'
|
||||
import { Collection } from '@discordeno/utils'
|
||||
import {
|
||||
DiscordApplicationIntegrationType,
|
||||
type Bot,
|
||||
type Channel,
|
||||
type Component,
|
||||
DiscordApplicationIntegrationType,
|
||||
type DiscordChannel,
|
||||
type DiscordInteractionContextType,
|
||||
type Guild,
|
||||
@@ -286,7 +286,7 @@ export function transformInteractionDataResolved(bot: Bot, resolved: DiscordInte
|
||||
|
||||
if (resolved.messages) {
|
||||
transformed.messages = new Collection(
|
||||
Object.entries(resolved.messages).map(([id, value]) => {
|
||||
Object.entries(resolved.messages).map(([_id, value]) => {
|
||||
const message: Message = bot.transformers.message(bot, value)
|
||||
return [message.id, message]
|
||||
}),
|
||||
@@ -295,7 +295,7 @@ export function transformInteractionDataResolved(bot: Bot, resolved: DiscordInte
|
||||
|
||||
if (resolved.users) {
|
||||
transformed.users = new Collection(
|
||||
Object.entries(resolved.users).map(([id, value]) => {
|
||||
Object.entries(resolved.users).map(([_id, value]) => {
|
||||
const user = bot.transformers.user(bot, value)
|
||||
return [user.id, user]
|
||||
}),
|
||||
@@ -313,7 +313,7 @@ export function transformInteractionDataResolved(bot: Bot, resolved: DiscordInte
|
||||
|
||||
if (guildId && resolved.roles) {
|
||||
transformed.roles = new Collection(
|
||||
Object.entries(resolved.roles).map(([id, value]) => {
|
||||
Object.entries(resolved.roles).map(([_id, value]) => {
|
||||
const role = bot.transformers.role(bot, { role: value, guildId })
|
||||
return [role.id, role]
|
||||
}),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { DiscordApplication, DiscordInviteCreate, DiscordInviteMetadata, DiscordInviteType } from '@discordeno/types'
|
||||
import { isInviteWithMetadata, type Application, type Bot, type ScheduledEvent, type User } from '../index.js'
|
||||
import { type Application, type Bot, type ScheduledEvent, type User, isInviteWithMetadata } from '../index.js'
|
||||
import type { InviteStageInstance } from './stageInviteInstance.js'
|
||||
|
||||
export function transformInvite(bot: Bot, payload: { invite: DiscordInviteCreate | DiscordInviteMetadata; shardId: number }): Invite {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import {
|
||||
DiscordApplicationIntegrationType,
|
||||
MessageFlags,
|
||||
type DiscordMessage,
|
||||
type DiscordMessageCall,
|
||||
type DiscordMessageInteractionMetadata,
|
||||
type InteractionTypes,
|
||||
type MessageActivityTypes,
|
||||
MessageFlags,
|
||||
type MessageTypes,
|
||||
type StickerFormatTypes,
|
||||
} from '@discordeno/types'
|
||||
import { CHANNEL_MENTION_REGEX } from '../constants.js'
|
||||
import { snowflakeToTimestamp, type Bot, type Poll } from '../index.js'
|
||||
import { type Bot, type Poll, snowflakeToTimestamp } from '../index.js'
|
||||
import type { Attachment } from './attachment.js'
|
||||
import type { Channel } from './channel.js'
|
||||
import type { Component } from './component.js'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PresenceStatus, type DiscordPresenceUpdate } from '@discordeno/types'
|
||||
import { type DiscordPresenceUpdate, PresenceStatus } from '@discordeno/types'
|
||||
import type { Activity, Bot, User } from '../index.js'
|
||||
|
||||
export function transformPresence(bot: Bot, payload: DiscordPresenceUpdate): PresenceUpdate {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot, DiscordActivity } from '../../index.js'
|
||||
import type { Activity } from '../activity.js'
|
||||
|
||||
export function transformActivityToDiscordActivity(bot: Bot, payload: Activity): DiscordActivity {
|
||||
export function transformActivityToDiscordActivity(_bot: Bot, payload: Activity): DiscordActivity {
|
||||
return {
|
||||
name: payload.name,
|
||||
type: payload.type,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AllowedMentions, Bot, DiscordAllowedMentions } from '../../index.js'
|
||||
|
||||
export function transformAllowedMentionsToDiscordAllowedMentions(bot: Bot, mentions: AllowedMentions): DiscordAllowedMentions {
|
||||
export function transformAllowedMentionsToDiscordAllowedMentions(_bot: Bot, mentions: AllowedMentions): DiscordAllowedMentions {
|
||||
return {
|
||||
parse: mentions.parse,
|
||||
replied_user: mentions.repliedUser,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { iconBigintToHash, type Bot, type DiscordApplication } from '../../index.js'
|
||||
import { type Bot, type DiscordApplication, iconBigintToHash } from '../../index.js'
|
||||
import type { Application } from '../application.js'
|
||||
|
||||
export function transformApplicationToDiscordApplication(bot: Bot, payload: Application): DiscordApplication {
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Bot, Camelize, DiscordApplicationCommandOptionChoice } from '../..
|
||||
import type { ApplicationCommandOptionChoice } from '../applicationCommandOptionChoice.js'
|
||||
|
||||
export function transformApplicationCommandOptionChoiceToDiscordApplicationCommandOptionChoice(
|
||||
bot: Bot,
|
||||
_bot: Bot,
|
||||
payload: ApplicationCommandOptionChoice | Camelize<DiscordApplicationCommandOptionChoice>,
|
||||
): DiscordApplicationCommandOptionChoice {
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { DiscordAuditLogEntry } from '@discordeno/types'
|
||||
import { iconBigintToHash, type Bot } from '../../index.js'
|
||||
import { type Bot, iconBigintToHash } from '../../index.js'
|
||||
import type { AuditLogEntry } from '../auditLogEntry.js'
|
||||
|
||||
export function transformAuditLogEntryToDiscordAuditLogEntry(bot: Bot, payload: AuditLogEntry): DiscordAuditLogEntry {
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { DiscordEmbed } from '@discordeno/types'
|
||||
import type { Bot } from '../../index.js'
|
||||
import type { Embed } from '../embed.js'
|
||||
|
||||
export function transformEmbedToDiscordEmbed(bot: Bot, payload: Embed): DiscordEmbed {
|
||||
export function transformEmbedToDiscordEmbed(_bot: Bot, payload: Embed): DiscordEmbed {
|
||||
return {
|
||||
title: payload.title,
|
||||
type: payload.type,
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { Bot } from '../../bot.js'
|
||||
import type { Member } from '../member.js'
|
||||
import type { User } from '../user.js'
|
||||
|
||||
export function transformUserToDiscordUser(bot: Bot, payload: User): DiscordUser {
|
||||
export function transformUserToDiscordUser(_bot: Bot, payload: User): DiscordUser {
|
||||
return {
|
||||
id: payload.id.toString(),
|
||||
username: payload.username,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PresenceStatus, type DiscordPresenceUpdate } from '@discordeno/types'
|
||||
import { type DiscordPresenceUpdate, PresenceStatus } from '@discordeno/types'
|
||||
import type { Bot } from '../../index.js'
|
||||
import type { PresenceUpdate } from '../presence.js'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { DiscordTeam } from '@discordeno/types'
|
||||
import { iconBigintToHash, type Bot } from '../../index.js'
|
||||
import { type Bot, iconBigintToHash } from '../../index.js'
|
||||
import type { Team } from '../team.js'
|
||||
|
||||
export function transformTeamToDiscordTeam(bot: Bot, payload: Team): DiscordTeam {
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { DiscordGuildWidgetSettings } from '@discordeno/types'
|
||||
import type { Bot } from '../../index.js'
|
||||
import type { GuildWidgetSettings } from '../widgetSettings.js'
|
||||
|
||||
export function transformWidgetSettingsToDiscordWidgetSettings(bot: Bot, payload: GuildWidgetSettings): DiscordGuildWidgetSettings {
|
||||
export function transformWidgetSettingsToDiscordWidgetSettings(_bot: Bot, payload: GuildWidgetSettings): DiscordGuildWidgetSettings {
|
||||
return {
|
||||
enabled: payload.enabled,
|
||||
channel_id: payload.channelId ?? null,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { BigString, DiscordRole, RoleFlags } from '@discordeno/types'
|
||||
import { iconHashToBigInt, type Bot } from '../index.js'
|
||||
import { type Bot, iconHashToBigInt } from '../index.js'
|
||||
import { Permissions } from './toggles/Permissions.js'
|
||||
import { RoleToggles } from './toggles/role.js'
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import type {
|
||||
ScheduledEventPrivacyLevel,
|
||||
ScheduledEventStatus,
|
||||
} from '@discordeno/types'
|
||||
import { iconHashToBigInt, type Bot, type User } from '../index.js'
|
||||
import { type Bot, type User, iconHashToBigInt } from '../index.js'
|
||||
|
||||
export function transformScheduledEvent(bot: Bot, payload: DiscordScheduledEvent): ScheduledEvent {
|
||||
const props = bot.transformers.desiredProperties.scheduledEvent
|
||||
|
||||
@@ -24,7 +24,7 @@ export function transformInviteStageInstance(bot: Bot, payload: DiscordInviteSta
|
||||
|
||||
export interface InviteStageInstance {
|
||||
/** The members speaking in the Stage */
|
||||
members: Array<Partial<Member>>
|
||||
members: Partial<Member>[]
|
||||
/** The number of users in the Stage */
|
||||
participantCount: number
|
||||
/** The number of users speaking in the Stage */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { DiscordTeam, DiscordTeamMemberRole, TeamMembershipStates } from '@discordeno/types'
|
||||
import { iconHashToBigInt, type Bot, type User } from '../index.js'
|
||||
import { type Bot, type User, iconHashToBigInt } from '../index.js'
|
||||
|
||||
export function transformTeam(bot: Bot, payload: DiscordTeam): Team {
|
||||
const id = bot.transformers.snowflake(payload.id)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type PermissionStrings, BitwisePermissionFlags } from '@discordeno/types'
|
||||
import { BitwisePermissionFlags, type PermissionStrings } from '@discordeno/types'
|
||||
import { ToggleBitfieldBigint } from './ToggleBitfield.js'
|
||||
|
||||
export class Permissions extends ToggleBitfieldBigint {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GuildFeatures, type DiscordGuild } from '@discordeno/types'
|
||||
import { type DiscordGuild, GuildFeatures } from '@discordeno/types'
|
||||
import { ToggleBitfieldBigint } from './ToggleBitfield.js'
|
||||
|
||||
const featureNames = [
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import type { DiscordUser, PremiumTypes } from '@discordeno/types'
|
||||
import { iconHashToBigInt } from '@discordeno/utils'
|
||||
import { ToggleBitfield, UserToggles, type AvatarDecorationData, type Bot } from '../index.js'
|
||||
import { type AvatarDecorationData, type Bot, ToggleBitfield, UserToggles } from '../index.js'
|
||||
|
||||
const baseUser: Partial<User> & BaseUser = {
|
||||
get tag() {
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
return `${this.username}#${this.discriminator}`
|
||||
},
|
||||
get bot() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { DiscordWebhook, WebhookTypes } from '@discordeno/types'
|
||||
import { iconHashToBigInt, type Bot, type Channel, type Guild, type User } from '../index.js'
|
||||
import { type Bot, type Channel, type Guild, type User, iconHashToBigInt } from '../index.js'
|
||||
|
||||
export function transformWebhook(bot: Bot, payload: DiscordWebhook): Webhook {
|
||||
const props = bot.transformers.desiredProperties.webhook
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { DiscordGuildWidget } from '@discordeno/types'
|
||||
import { iconHashToBigInt, type Bot } from '../index.js'
|
||||
import { type Bot, iconHashToBigInt } from '../index.js'
|
||||
|
||||
export function transformWidget(bot: Bot, payload: DiscordGuildWidget): GuildWidget {
|
||||
const widget = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
ApplicationCommandTypes,
|
||||
type AllowedMentions,
|
||||
ApplicationCommandTypes,
|
||||
type ButtonStyles,
|
||||
type ChannelTypes,
|
||||
type CreateApplicationCommand,
|
||||
|
||||
Reference in New Issue
Block a user