mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
feat(Browser): remove browser � (#5113)
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
const MessageAttachment = require('./MessageAttachment');
|
||||
const MessageEmbed = require('./MessageEmbed');
|
||||
const { RangeError } = require('../errors');
|
||||
const { browser } = require('../util/Constants');
|
||||
const DataResolver = require('../util/DataResolver');
|
||||
const MessageFlags = require('../util/MessageFlags');
|
||||
const Util = require('../util/Util');
|
||||
@@ -272,9 +271,7 @@ class APIMessage {
|
||||
};
|
||||
|
||||
const ownAttachment =
|
||||
typeof fileLike === 'string' ||
|
||||
fileLike instanceof (browser ? ArrayBuffer : Buffer) ||
|
||||
typeof fileLike.pipe === 'function';
|
||||
typeof fileLike === 'string' || fileLike instanceof Buffer || typeof fileLike.pipe === 'function';
|
||||
if (ownAttachment) {
|
||||
attachment = fileLike;
|
||||
name = findName(attachment);
|
||||
|
||||
@@ -18,7 +18,6 @@ const RoleManager = require('../managers/RoleManager');
|
||||
const VoiceStateManager = require('../managers/VoiceStateManager');
|
||||
const Collection = require('../util/Collection');
|
||||
const {
|
||||
browser,
|
||||
ChannelTypes,
|
||||
DefaultMessageNotifications,
|
||||
PartialTypes,
|
||||
@@ -991,7 +990,7 @@ class Guild extends Base {
|
||||
}
|
||||
const data = await this.client.api.guilds(this.id).members(user).put({ data: options });
|
||||
// Data is an empty buffer if the member is already part of the guild.
|
||||
return data instanceof (browser ? ArrayBuffer : Buffer) ? this.members.fetch(user) : this.members.add(data);
|
||||
return data instanceof Buffer ? this.members.fetch(user) : this.members.add(data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const GuildChannel = require('./GuildChannel');
|
||||
const { Error } = require('../errors');
|
||||
const Collection = require('../util/Collection');
|
||||
const { browser } = require('../util/Constants');
|
||||
const Permissions = require('../util/Permissions');
|
||||
|
||||
/**
|
||||
@@ -74,7 +72,6 @@ class VoiceChannel extends GuildChannel {
|
||||
* @readonly
|
||||
*/
|
||||
get joinable() {
|
||||
if (browser) return false;
|
||||
if (!this.viewable) return false;
|
||||
if (!this.permissionsFor(this.client.user).has(Permissions.FLAGS.CONNECT, false)) return false;
|
||||
if (this.full && !this.permissionsFor(this.client.user).has(Permissions.FLAGS.MOVE_MEMBERS, false)) return false;
|
||||
@@ -130,7 +127,6 @@ class VoiceChannel extends GuildChannel {
|
||||
* .catch(console.error);
|
||||
*/
|
||||
join() {
|
||||
if (browser) return Promise.reject(new Error('VOICE_NO_BROWSER'));
|
||||
return this.client.voice.joinChannel(this);
|
||||
}
|
||||
|
||||
@@ -141,7 +137,6 @@ class VoiceChannel extends GuildChannel {
|
||||
* voiceChannel.leave();
|
||||
*/
|
||||
leave() {
|
||||
if (browser) return;
|
||||
const connection = this.client.voice.connections.get(this.guild.id);
|
||||
if (connection && connection.channel.id === this.id) connection.disconnect();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
const Base = require('./Base');
|
||||
const { Error, TypeError } = require('../errors');
|
||||
const { browser } = require('../util/Constants');
|
||||
|
||||
/**
|
||||
* Represents the voice state for a Guild Member.
|
||||
@@ -95,7 +94,7 @@ class VoiceState extends Base {
|
||||
* @readonly
|
||||
*/
|
||||
get connection() {
|
||||
if (browser || this.id !== this.client.user.id) return null;
|
||||
if (this.id !== this.client.user.id) return null;
|
||||
return this.client.voice.connections.get(this.guild.id) || null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user