mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
fixed mentions even though they will be changed in the future... why
This commit is contained in:
@@ -495,7 +495,10 @@ var InternalClient = (function () {
|
||||
return this.resolver.resolveChannel(where).then(function (destination) {
|
||||
//var destination;
|
||||
var content = _this10.resolver.resolveString(_content);
|
||||
var mentions = _this10.resolver.resolveMentions(content);
|
||||
var resolved = _this10.resolver.resolveMentions(content);
|
||||
|
||||
var mentions = resolved[0],
|
||||
content = resolved[1];
|
||||
|
||||
return _this10.apiRequest("post", _Constants.Endpoints.CHANNEL_MESSAGES(destination.id), true, {
|
||||
content: content,
|
||||
|
||||
@@ -125,6 +125,7 @@ var Resolver = (function () {
|
||||
Resolver.prototype.resolveMentions = function resolveMentions(resource) {
|
||||
// resource is a string
|
||||
var _mentions = [];
|
||||
var changed = resource;
|
||||
for (var _iterator = resource.match(/<@[^>]*>/g) || [], _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref;
|
||||
|
||||
@@ -139,9 +140,12 @@ var Resolver = (function () {
|
||||
|
||||
var mention = _ref;
|
||||
|
||||
_mentions.push(mention.substring(2, mention.length - 1));
|
||||
var 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;
|
||||
console.log(changed);
|
||||
return [_mentions, changed];
|
||||
};
|
||||
|
||||
Resolver.prototype.resolveString = function resolveString(resource) {
|
||||
|
||||
Reference in New Issue
Block a user