mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 01:10:07 +00:00
deno fmt
This commit is contained in:
@@ -10,8 +10,6 @@ import { cache } from "../utils/cache.ts";
|
||||
|
||||
export let authorization = "";
|
||||
export let botID = "";
|
||||
/** The bot's token. This should never be used by end users. It is meant to be used internally to make requests to the Discord API. */
|
||||
export let token = "";
|
||||
|
||||
export let eventHandlers: EventHandlers = {};
|
||||
|
||||
@@ -31,7 +29,6 @@ export const identifyPayload = {
|
||||
|
||||
export const createClient = async (data: ClientOptions) => {
|
||||
botID = data.botID;
|
||||
token = data.token;
|
||||
if (data.eventHandlers) eventHandlers = data.eventHandlers;
|
||||
authorization = `Bot ${data.token}`;
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
import { logRed } from "../utils/logger.ts";
|
||||
import { sendConstantHeartbeats, previousSequenceNumber } from "./gateway.ts";
|
||||
|
||||
logRed("shard file running");
|
||||
export const USELESS_ARG_TO_MAKE_DENO_CACHE_WORK = undefined;
|
||||
/** The session id is needed for RESUME functionality when discord disconnects randomly. */
|
||||
let sessionID = "";
|
||||
|
||||
@@ -315,7 +315,7 @@ function handleDiscordPayload(data: DiscordPayload) {
|
||||
guild?.members.set(
|
||||
options.author.id,
|
||||
createMember(
|
||||
options.member,
|
||||
{ ...options.member, user: options.author },
|
||||
options.guild_id,
|
||||
[...guild.roles.values()].map((r) => r.raw),
|
||||
guild.owner_id,
|
||||
|
||||
@@ -88,19 +88,17 @@ export function createChannel(data: ChannelCreatePayload) {
|
||||
|
||||
if (options?.limit && options.limit > 100) return;
|
||||
|
||||
const result =
|
||||
(await RequestManager.get(
|
||||
endpoints.CHANNEL_MESSAGES(data.id),
|
||||
options,
|
||||
)) as MessageCreateOptions[];
|
||||
const result = (await RequestManager.get(
|
||||
endpoints.CHANNEL_MESSAGES(data.id),
|
||||
options,
|
||||
)) as MessageCreateOptions[];
|
||||
return result.map((res) => createMessage(res));
|
||||
},
|
||||
/** Get pinned messages in this channel. */
|
||||
getPins: async () => {
|
||||
const result =
|
||||
(await RequestManager.get(
|
||||
endpoints.CHANNEL_PINS(data.id),
|
||||
)) as MessageCreateOptions[];
|
||||
const result = (await RequestManager.get(
|
||||
endpoints.CHANNEL_PINS(data.id),
|
||||
)) as MessageCreateOptions[];
|
||||
return result.map((res) => createMessage(res));
|
||||
},
|
||||
/** Send a message to the channel. Requires SEND_MESSAGES permission. */
|
||||
@@ -133,6 +131,7 @@ export function createChannel(data: ChannelCreatePayload) {
|
||||
endpoints.CHANNEL_MESSAGES(data.id),
|
||||
content,
|
||||
);
|
||||
console.log(result);
|
||||
return createMessage(result);
|
||||
},
|
||||
|
||||
|
||||
@@ -229,11 +229,10 @@ export const createGuild = (data: CreateGuildPayload) => {
|
||||
) {
|
||||
throw new Error(Errors.MISSING_KICK_MEMBERS);
|
||||
}
|
||||
const result =
|
||||
(await RequestManager.get(
|
||||
endpoints.GUILD_PRUNE(data.id),
|
||||
{ days },
|
||||
)) as PrunePayload;
|
||||
const result = (await RequestManager.get(
|
||||
endpoints.GUILD_PRUNE(data.id),
|
||||
{ days },
|
||||
)) as PrunePayload;
|
||||
return result.pruned;
|
||||
},
|
||||
/** Begin pruning all members in the given time period */
|
||||
|
||||
Reference in New Issue
Block a user