mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
make useragent better because data is fun (#1244)
* Update UserAgentManager.js * Update UserAgentManager.js * gawdl3y is one of the most pants-on-head retarded people i have ever met * Update UserAgentManager.js * Update UserAgentManager.js * Update UserAgentManager.js * Update UserAgentManager.js
This commit is contained in:
committed by
Schuyler Cebulskie
parent
58068fdae9
commit
3e0c0f44a2
@@ -1,22 +1,25 @@
|
|||||||
const Constants = require('../../util/Constants');
|
const Constants = require('../../util/Constants');
|
||||||
|
|
||||||
class UserAgentManager {
|
class UserAgentManager {
|
||||||
constructor(restManager) {
|
constructor() {
|
||||||
this.restManager = restManager;
|
this.build(this.constructor.DEFAULT);
|
||||||
this._userAgent = {
|
|
||||||
url: 'https://github.com/hydrabolt/discord.js',
|
|
||||||
version: Constants.Package.version,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set(info) {
|
set({ url, version } = {}) {
|
||||||
this._userAgent.url = info.url || 'https://github.com/hydrabolt/discord.js';
|
this.build({
|
||||||
this._userAgent.version = info.version || Constants.Package.version;
|
url: url || this.constructor.DFEAULT.url,
|
||||||
|
version: version || this.constructor.DEFAULT.version,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get userAgent() {
|
build(ua) {
|
||||||
return `DiscordBot (${this._userAgent.url}, ${this._userAgent.version})`;
|
this.userAgent = `DiscordBot (${ua.url}, ${ua.version}) Node.js/${process.version}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UserAgentManager.DEFAULT = {
|
||||||
|
url: Constants.Package.homepage.split('#')[0],
|
||||||
|
version: Constants.Package.version,
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = UserAgentManager;
|
module.exports = UserAgentManager;
|
||||||
|
|||||||
Reference in New Issue
Block a user