mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
fixed mentions even though they will be changed in the future... why
This commit is contained in:
@@ -393,7 +393,9 @@ export default class InternalClient {
|
||||
.then(destination => {
|
||||
//var destination;
|
||||
var content = this.resolver.resolveString(_content);
|
||||
var mentions = this.resolver.resolveMentions(content);
|
||||
var resolved = this.resolver.resolveMentions(content);
|
||||
|
||||
var mentions = resolved[0], content = resolved[1];
|
||||
|
||||
return this.apiRequest("post", Endpoints.CHANNEL_MESSAGES(destination.id), true, {
|
||||
content: content,
|
||||
|
||||
@@ -84,10 +84,13 @@ export default class Resolver {
|
||||
resolveMentions(resource) {
|
||||
// resource is a string
|
||||
var _mentions = [];
|
||||
var changed = resource;
|
||||
for (var mention of (resource.match(/<@[^>]*>/g) || [])) {
|
||||
_mentions.push(mention.substring(2, mention.length - 1));
|
||||
let userID = mention.substring(2, mention.length - 1);
|
||||
_mentions.push(userID);
|
||||
changed = changed.replace(new RegExp(mention, "g"), `@${this.internal.client.users.get("id", userID).username}`);
|
||||
}
|
||||
return _mentions;
|
||||
return [_mentions, changed];
|
||||
}
|
||||
|
||||
resolveString(resource) {
|
||||
|
||||
@@ -256,9 +256,10 @@ export default class VoiceConnection extends EventEmitter {
|
||||
|
||||
init() {
|
||||
var self = this;
|
||||
console.log("\n\nendpoint:", this.endpoint, "\n\n");
|
||||
dns.lookup(this.endpoint, (err, address, family) => {
|
||||
this.endpoint = address;
|
||||
var vWS = self.vWS = new WebSocket("wss://" + this.endpoint, null, { rejectUnauthorized: false });
|
||||
this.endpoint = address;
|
||||
var udpClient = self.udp = udp.createSocket("udp4");
|
||||
|
||||
var firstPacket = true;
|
||||
|
||||
Reference in New Issue
Block a user