mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 02:23:31 +01:00
Added user-agent with discord.js information
Requested by the Discord Team
This commit is contained in:
@@ -22,10 +22,12 @@ import Invite from "../Structures/Invite";
|
|||||||
import VoiceConnection from "../Voice/VoiceConnection";
|
import VoiceConnection from "../Voice/VoiceConnection";
|
||||||
|
|
||||||
var zlib;
|
var zlib;
|
||||||
|
var libVersion = require('../../package.json').version;
|
||||||
|
|
||||||
//todo: move this somewhere else
|
//todo: move this somewhere else
|
||||||
var originalEnd = request.Request.prototype.end;
|
var originalEnd = request.Request.prototype.end;
|
||||||
request.Request.prototype.end = function(callback) {
|
request.Request.prototype.end = function(callback) {
|
||||||
|
this.set('User-Agent', 'DiscordBot (https://github.com/hydrabolt/discord.js, ' + libVersion + ')');
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
originalEnd.call(this, (err, response) => {
|
originalEnd.call(this, (err, response) => {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
|
|||||||
Reference in New Issue
Block a user