Skip to content

Commit 3705011

Browse files
JustDamsweb-flow
andauthored
Update/link (#456)
* feat: new translation string EN * fix: translation reference * feat: new translation string DE, FR, RO, RU, UA * feat: ephemeral unlink --------- Co-authored-by: JustDams <noreply@github.com>
1 parent 569b05c commit 3705011

34 files changed

+91
-42
lines changed

commands/link.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,15 @@ const sendCardWithInfo = async (interaction, playerParam) => {
3737
}
3838

3939
const link = async (interaction, playerParam, discordId, guildId = null, nickname) => {
40-
const user = await User.exists(discordId, guildId)
41-
if (!!user?.verified) return errorCard('error.user.unlink.verified', interaction.locale)
40+
const verified = await User.getVerified(discordId)
41+
if (verified.length > 0) {
42+
const error = interaction.user.id === discordId ?
43+
'error.user.unlink.verified' :
44+
'error.user.link.verified.other'
45+
return errorCard(error, interaction.locale)
46+
}
4247

48+
const user = await User.exists(discordId, guildId)
4349
const {
4450
playerDatas
4551
} = await getStats({
@@ -49,7 +55,6 @@ const link = async (interaction, playerParam, discordId, guildId = null, nicknam
4955
})
5056

5157
const playerId = playerDatas.player_id
52-
5358
if (guildId) await User.remove(discordId, null, false)
5459

5560
user ?
@@ -105,6 +110,7 @@ module.exports = {
105110
usage: '[<steam_parameter> <faceit_parameter>] <discord_user> <nickname>',
106111
example: 'steam_parameter: justdams',
107112
type: 'utility',
113+
ephemeral: true,
108114
async execute(interaction) {
109115
return getCardsConditions({
110116
interaction,

commands/unlink.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ module.exports = {
4242
descriptionLocalizations: getTranslations('command.unlink.description'),
4343
usage: '',
4444
type: 'utility',
45+
ephemeral: true,
4546
async execute(interaction) {
4647
return sendCardWithInfo(interaction)
4748
}

config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"join": "https://discord.gg/uPAdfvfuTP",
1111
"oauth2": "https://faceitfinder.app/api/auth/discord/login",
1212
"unlinkVerified": "https://faceitfinder.app/profile/settings",
13+
"linkVerified": "https://faceitfinder.app/profile/connections",
1314
"logChannel": "1120786737636048976",
1415
"logGuild": "882210656328228895",
1516
"itemByPage": 25,

languages/base.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,12 @@ module.exports = {
185185
mapNotPlayed: '',
186186
unlink: {
187187
verified: '',
188-
}
188+
},
189+
link: {
190+
verified: {
191+
other: '',
192+
},
193+
},
189194
},
190195
execution: {
191196
command: '',

languages/bg-BG/translations.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable semi */
2-
const { maxLengthTeamName, invite, join, oauth2, unlinkVerified } = require('../../config.json')
2+
const { maxLengthTeamName, invite, join, oauth2, unlinkVerified, linkVerified } = require('../../config.json')
33
const base = structuredClone(require('../base'))
44
base.command.compare.description = 'Compare both user stats'
55
base.command.dailystats.description = 'Displays the stats of the chosen day, with elo graph of the day'
@@ -147,6 +147,7 @@ base.error.user.globalLink = '{discord} already has a global link'
147147
base.error.user.notFound = 'The requested user is not on this server'
148148
base.error.user.mapNotPlayed = 'The player **{playerName}** hasn\'t played on this map'
149149
base.error.user.unlink.verified = `Since your account is verified, you have to unlink your account on the website, click on the link below to do so\n${unlinkVerified}`
150+
base.error.user.link.verified.other = `This account is verified, the user will have to select the guild on the website to link it\n${linkVerified}`
150151
base.error.execution.command = 'An error occurred while executing the command'
151152
base.error.execution.selectmenu = 'An error occurred while executing the select menu'
152153
base.error.execution.button = 'An error occurred while executing the button'

languages/cs-CZ/translations.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable semi */
2-
const { maxLengthTeamName, invite, join, oauth2, unlinkVerified } = require('../../config.json')
2+
const { maxLengthTeamName, invite, join, oauth2, unlinkVerified, linkVerified } = require('../../config.json')
33
const base = structuredClone(require('../base'))
44
base.command.compare.description = 'Compare both user stats'
55
base.command.dailystats.description = 'Displays the stats of the chosen day, with elo graph of the day'
@@ -147,6 +147,7 @@ base.error.user.globalLink = '{discord} already has a global link'
147147
base.error.user.notFound = 'The requested user is not on this server'
148148
base.error.user.mapNotPlayed = 'The player **{playerName}** hasn\'t played on this map'
149149
base.error.user.unlink.verified = `Since your account is verified, you have to unlink your account on the website, click on the link below to do so\n${unlinkVerified}`
150+
base.error.user.link.verified.other = `This account is verified, the user will have to select the guild on the website to link it\n${linkVerified}`
150151
base.error.execution.command = 'An error occurred while executing the command'
151152
base.error.execution.selectmenu = 'An error occurred while executing the select menu'
152153
base.error.execution.button = 'An error occurred while executing the button'

languages/da-DK/translations.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable semi */
2-
const { maxLengthTeamName, invite, join, oauth2, unlinkVerified } = require('../../config.json')
2+
const { maxLengthTeamName, invite, join, oauth2, unlinkVerified, linkVerified } = require('../../config.json')
33
const base = structuredClone(require('../base'))
44
base.command.compare.description = 'Compare both user stats'
55
base.command.dailystats.description = 'Displays the stats of the chosen day, with elo graph of the day'
@@ -147,6 +147,7 @@ base.error.user.globalLink = '{discord} already has a global link'
147147
base.error.user.notFound = 'The requested user is not on this server'
148148
base.error.user.mapNotPlayed = 'The player **{playerName}** hasn\'t played on this map'
149149
base.error.user.unlink.verified = `Since your account is verified, you have to unlink your account on the website, click on the link below to do so\n${unlinkVerified}`
150+
base.error.user.link.verified.other = `This account is verified, the user will have to select the guild on the website to link it\n${linkVerified}`
150151
base.error.execution.command = 'An error occurred while executing the command'
151152
base.error.execution.selectmenu = 'An error occurred while executing the select menu'
152153
base.error.execution.button = 'An error occurred while executing the button'

languages/de-DE/translations.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable semi */
2-
const { maxLengthTeamName, invite, join, oauth2, unlinkVerified } = require('../../config.json');
2+
const { maxLengthTeamName, invite, join, oauth2, unlinkVerified, linkVerified } = require('../../config.json');
33
const base = structuredClone(require('../base'));
44
base.command.compare.description = 'Vergleiche beide User Statistiken';
55
base.command.dailystats.description = 'Zeigt die Statistiken des ausgewählten Tages mit der Elo-Grafik des Tages an.';
@@ -143,6 +143,7 @@ base.error.user.globalLink = '{discord} hat schon einen Globalen-Link';
143143
base.error.user.notFound = 'Der angefragte User ist nicht auf dem Server';
144144
base.error.user.mapNotPlayed = 'Der Spieler **{playerName}**, hat noch nicht auf dieser Karte gespielt';
145145
base.error.user.unlink.verified = `Da Ihr Konto verifiziert ist, müssen Sie Ihr Konto auf der Website trennen. Klicken Sie auf den unten stehenden Link, um dies zu tun\n${unlinkVerified}`;
146+
base.error.user.link.verified.other = `Dieses Konto ist verifiziert, der Benutzer muss die Gilde auf der Website auswählen, um sie zu verknüpfen\n${linkVerified}`;
146147
base.error.execution.command = 'Es ist ein Fehler aufgetreten, während der Befehl ausgeführt wurde';
147148
base.error.execution.selectmenu = 'Es ist ein Fehler aufgetreten, während das Auswahlfeld ausgeführt wurde';
148149
base.error.execution.button = 'Es ist ein Fehler aufgetreten, während des Drückens des Knopfes';

languages/el-GR/translations.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable semi */
2-
const { maxLengthTeamName, invite, join, oauth2, unlinkVerified } = require('../../config.json')
2+
const { maxLengthTeamName, invite, join, oauth2, unlinkVerified, linkVerified } = require('../../config.json')
33
const base = structuredClone(require('../base'))
44
base.command.compare.description = 'Compare both user stats'
55
base.command.dailystats.description = 'Displays the stats of the chosen day, with elo graph of the day'
@@ -120,6 +120,7 @@ base.strings.pagination = {
120120
last: 'Last Page'
121121
}
122122
base.strings.donate = 'Support the project'
123+
base.strings.translation = 'Help with the translation'
123124
base.strings.fullHistory = 'Full history'
124125
base.strings.verifyDescription = `Hey {discord}, to verify your faceit account click on the link below!\n${oauth2}\nOnce you have verified your account, you will be able to get the linked role, and more !`
125126
base.strings.verify = 'Verification'
@@ -146,6 +147,7 @@ base.error.user.globalLink = '{discord} already has a global link'
146147
base.error.user.notFound = 'The requested user is not on this server'
147148
base.error.user.mapNotPlayed = 'The player **{playerName}** hasn\'t played on this map'
148149
base.error.user.unlink.verified = `Since your account is verified, you have to unlink your account on the website, click on the link below to do so\n${unlinkVerified}`
150+
base.error.user.link.verified.other = `This account is verified, the user will have to select the guild on the website to link it\n${linkVerified}`
149151
base.error.execution.command = 'An error occurred while executing the command'
150152
base.error.execution.selectmenu = 'An error occurred while executing the select menu'
151153
base.error.execution.button = 'An error occurred while executing the button'

languages/en-GB/translations.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable semi */
2-
const { maxLengthTeamName, invite, join, oauth2, unlinkVerified } = require('../../config.json')
2+
const { maxLengthTeamName, invite, join, oauth2, unlinkVerified, linkVerified } = require('../../config.json')
33
const base = structuredClone(require('../base'))
44
base.command.compare.description = 'Compare both user stats'
55
base.command.dailystats.description = 'Displays the stats of the chosen day, with elo graph of the day'
@@ -120,10 +120,10 @@ base.strings.pagination = {
120120
last: 'Last Page'
121121
}
122122
base.strings.donate = 'Support the project'
123+
base.strings.translation = 'Help with the translation'
123124
base.strings.fullHistory = 'Full history'
124125
base.strings.verifyDescription = `Hey {discord}, to verify your faceit account click on the link below!\n${oauth2}\nOnce you have verified your account, you will be able to get the linked role, and more !`
125126
base.strings.verify = 'Verification'
126-
base.strings.premiumDesc = 'This feature is only available for premium guilds. Become a premium guild by clicking on the button below'
127127
base.error.user.missing = 'It seems like there is a user missing'
128128
base.error.user.compareSame = 'You can\'t compare the same user'
129129
base.error.user.excluded = 'You can\'t exclude a player you are searching for'
@@ -147,6 +147,7 @@ base.error.user.globalLink = '{discord} already has a global link'
147147
base.error.user.notFound = 'The requested user is not on this server'
148148
base.error.user.mapNotPlayed = 'The player **{playerName}** hasn\'t played on this map'
149149
base.error.user.unlink.verified = `Since your account is verified, you have to unlink your account on the website, click on the link below to do so\n${unlinkVerified}`
150+
base.error.user.link.verified.other = `This account is verified, the user will have to select the guild on the website to link it\n${linkVerified}`
150151
base.error.execution.command = 'An error occurred while executing the command'
151152
base.error.execution.selectmenu = 'An error occurred while executing the select menu'
152153
base.error.execution.button = 'An error occurred while executing the button'

0 commit comments

Comments
 (0)