mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
Remove all string object references (#586)
This commit is contained in:
committed by
Amish Shah
parent
ec0a5cdfbc
commit
d97ce2e181
@@ -31,7 +31,7 @@ class DMChannel extends Channel {
|
||||
}
|
||||
|
||||
/**
|
||||
* When concatenated with a String, this automatically concatenates the recipient's mention instead of the
|
||||
* When concatenated with a string, this automatically concatenates the recipient's mention instead of the
|
||||
* DM channel object.
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
@@ -68,7 +68,7 @@ class Emoji {
|
||||
}
|
||||
|
||||
/**
|
||||
* When concatenated with a String, this automatically returns the emoji mention rather than the object.
|
||||
* When concatenated with a string, this automatically returns the emoji mention rather than the object.
|
||||
* @returns {string}
|
||||
* @example
|
||||
* // send an emoji:
|
||||
|
||||
@@ -39,7 +39,7 @@ class EvaluatedPermissions {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
hasPermission(permission, explicit = false) {
|
||||
if (permission instanceof String || typeof permission === 'string') {
|
||||
if (typeof permission === 'string') {
|
||||
permission = Constants.PermissionFlags[permission];
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ class Guild {
|
||||
}
|
||||
|
||||
/**
|
||||
* When concatenated with a String, this automatically concatenates the Guild's name instead of the Guild object.
|
||||
* When concatenated with a string, this automatically concatenates the Guild's name instead of the Guild object.
|
||||
* @returns {string}
|
||||
* @example
|
||||
* // logs: Hello from My Guild!
|
||||
|
||||
@@ -263,7 +263,7 @@ class GuildChannel extends Channel {
|
||||
}
|
||||
|
||||
/**
|
||||
* When concatenated with a String, this automatically returns the Channel's mention instead of the Channel object.
|
||||
* When concatenated with a string, this automatically returns the Channel's mention instead of the Channel object.
|
||||
* @returns {string}
|
||||
* @example
|
||||
* // Outputs: Hello from #general
|
||||
|
||||
@@ -198,7 +198,7 @@ class Role {
|
||||
* }
|
||||
*/
|
||||
hasPermission(permission, explicit = false) {
|
||||
if (permission instanceof String || typeof permission === 'string') {
|
||||
if (typeof permission === 'string') {
|
||||
permission = Constants.PermissionFlags[permission];
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ class Role {
|
||||
}
|
||||
|
||||
/**
|
||||
* When concatenated with a String, this automatically concatenates the Role mention rather than the Role object.
|
||||
* When concatenated with a string, this automatically concatenates the Role mention rather than the Role object.
|
||||
* @returns {string}
|
||||
*/
|
||||
toString() {
|
||||
|
||||
@@ -56,7 +56,7 @@ class User {
|
||||
}
|
||||
|
||||
/**
|
||||
* When concatenated with a String, this automatically concatenates the User's mention instead of the User object.
|
||||
* When concatenated with a string, this automatically concatenates the User's mention instead of the User object.
|
||||
* @returns {string}
|
||||
* @example
|
||||
* // logs: Hello from <@123456789>!
|
||||
|
||||
@@ -196,7 +196,7 @@ class TextBasedChannel {
|
||||
*/
|
||||
sendFile(attachment, fileName) {
|
||||
if (!fileName) {
|
||||
if (attachment instanceof String || typeof attachment === 'string') {
|
||||
if (typeof attachment === 'string') {
|
||||
fileName = path.basename(attachment);
|
||||
} else if (attachment && attachment.path) {
|
||||
fileName = path.basename(attachment.path);
|
||||
|
||||
Reference in New Issue
Block a user