mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-17 22:03:50 +02:00
List Discord usernames in friends list
This commit is contained in:
@@ -10416,6 +10416,55 @@ speechSynthesis.getVoices();
|
||||
});
|
||||
};
|
||||
|
||||
$app.data.discordNamesDialogVisible = false;
|
||||
$app.data.discordNamesContent = '';
|
||||
|
||||
$app.methods.showDiscordNamesDialog = function () {
|
||||
var { friends } = API.currentUser;
|
||||
if (Array.isArray(friends) === false) {
|
||||
return;
|
||||
}
|
||||
var lines = [
|
||||
'DisplayName,DiscordName'
|
||||
];
|
||||
var _ = function (str) {
|
||||
if (/[\x00-\x1f,"]/.test(str) === true) {
|
||||
str = `"${str.replace(/"/g, '""')}"`;
|
||||
}
|
||||
return str;
|
||||
};
|
||||
for (var userId of friends) {
|
||||
var { ref } = this.friends.get(userId);
|
||||
var discord = '';
|
||||
if (typeof ref === 'undefined') {
|
||||
continue;
|
||||
}
|
||||
var name = ref.displayName;
|
||||
if (ref.statusDescription) {
|
||||
var statusRegex = /(?:^|\n*)(?:(?:[^\n:]|\|)*(?::|˸|discord)[\t\v\f\r]*)?([^\n]*(#|#)(?: )?\d{4})/gi.exec(ref.statusDescription);
|
||||
if (statusRegex) {
|
||||
discord = statusRegex[1];
|
||||
}
|
||||
}
|
||||
if ((!discord) && (ref.bio)) {
|
||||
var bioRegex = /(?:^|\n*)(?:(?:[^\n:]|\|)*(?::|˸|discord)[\t\v\f\r]*)?([^\n]*(#|#)(?: )?\d{4})/gi.exec(ref.bio);
|
||||
if (bioRegex) {
|
||||
discord = bioRegex[1];
|
||||
}
|
||||
}
|
||||
if (!discord) {
|
||||
continue;
|
||||
}
|
||||
discord = discord.replace('#', '#');
|
||||
if (discord.substring(0, 1) === '#') {
|
||||
discord = `${_(name)}${_(discord)}`;
|
||||
}
|
||||
lines.push(`${_(name)},${_(discord)}`);
|
||||
}
|
||||
this.discordNamesContent = lines.join('\n');
|
||||
this.discordNamesDialogVisible = true;
|
||||
};
|
||||
|
||||
$app = new Vue($app);
|
||||
window.$app = $app;
|
||||
}());
|
||||
|
||||
@@ -427,6 +427,7 @@ html
|
||||
div(style="margin-top:10px")
|
||||
el-button(size="small" icon="el-icon-switch-button" @click="logout()") Logout
|
||||
el-button(size="small" icon="el-icon-printer" @click="showExportFriendsListDialog()") Export Friends List
|
||||
el-button(size="small" icon="el-icon-chat-dot-round" @click="showDiscordNamesDialog()") Discord Names
|
||||
div.options-container
|
||||
span.header Game Info
|
||||
.x-friend-list(style="margin-top:10px")
|
||||
@@ -1403,10 +1404,16 @@ html
|
||||
el-checkbox(v-model="launchDialog.desktop" style="float:left;margin-top:5px") Start as Desktop (No VR)
|
||||
el-button(size="small" @click="showInviteDialog(launchDialog.location)") Invite
|
||||
el-button(type="primary" size="small" @click="launchGame(locationToLaunchArg(launchDialog.location))") Launch
|
||||
|
||||
|
||||
//- dialog: export friends list
|
||||
el-dialog.x-dialog(:visible.sync="exportFriendsListDialog" title="Export Friends List" width="650px")
|
||||
el-input(type="textarea" v-model="exportFriendsListContent" size="mini" rows="15" resize="none" readonly style="margin-top:15px" @click.native="$event.target.tagName === 'TEXTAREA' && $event.target.select()")
|
||||
el-input(type="textarea" v-model="exportFriendsListContent" size="mini" rows="15" resize="none" readonly style="margin-top:15px" @click.native="$event.target.tagName === 'TEXTAREA' && $event.target.select()")
|
||||
|
||||
//- dialog: Discord username list
|
||||
el-dialog.x-dialog(:visible.sync="discordNamesDialogVisible" title="Discord Names" width="650px")
|
||||
div(style='font-size:12px;')
|
||||
| Click load missing entries in the Friends List tab to search entire friends list
|
||||
el-input(type="textarea" v-model="discordNamesContent" size="mini" rows="15" resize="none" readonly style="margin-top:15px")
|
||||
|
||||
//- dialog: Notification position
|
||||
el-dialog.x-dialog(ref="notificationPositionDialog" :visible.sync="notificationPositionDialog.visible" title="Notification Position" width="400px")
|
||||
|
||||
Reference in New Issue
Block a user