update discord adapter for new interface definition
This commit is contained in:
parent
25177b64ff
commit
ef4bb487df
@ -55,28 +55,21 @@ export default class DiscordAdapter {
|
|||||||
await interaction.reply(result)
|
await interaction.reply(result)
|
||||||
}
|
}
|
||||||
public async removeUser(interaction: CommandInteraction, registration: RegistrationHandler): Promise<void> {
|
public async removeUser(interaction: CommandInteraction, registration: RegistrationHandler): Promise<void> {
|
||||||
const discordUser = interaction.user
|
const discordUser: GuildMember = <GuildMember>interaction.member
|
||||||
if (!discordUser.username || discordUser.username == "") {
|
registration.removeUser(discordUser)
|
||||||
await interaction.reply(`This user does not seem to have a username, can't delete`)
|
await interaction.reply(`User has been removed`)
|
||||||
}
|
|
||||||
else {
|
|
||||||
registration.removeUser(discordUser.username)
|
|
||||||
await interaction.reply(`User has been removed`)
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
public async registerUser(interaction: CommandInteraction, registration: RegistrationHandler): Promise<void> {
|
public async registerUser(interaction: CommandInteraction, registration: RegistrationHandler): Promise<void> {
|
||||||
const discordUser = interaction.user
|
const discordUser: GuildMember = <GuildMember>interaction.member
|
||||||
const steamNameToRegister = interaction.options.getString('steamname')
|
const steamNameToRegister = interaction.options.getString('steamname')
|
||||||
if (!discordUser.username || discordUser.username == "") {
|
console.dir(discordUser)
|
||||||
await interaction.reply(`This user does not seem to have a username, can't register`)
|
if (!steamNameToRegister) {
|
||||||
}
|
|
||||||
else if (!steamNameToRegister) {
|
|
||||||
await interaction.reply(`No steam name supplied, can't register`)
|
await interaction.reply(`No steam name supplied, can't register`)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
registration.register(discordUser.username, steamNameToRegister)
|
registration.register(discordUser, steamNameToRegister)
|
||||||
await interaction.reply(`This should register user ${discordUser.username} with id ${discordUser.id} to use steamname: ${steamNameToRegister}`)
|
await interaction.reply(`This should register user ${discordUser.user.username} with id ${discordUser.user.id} to use steamname: ${steamNameToRegister}`)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -91,13 +84,9 @@ export default class DiscordAdapter {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
public async show(interaction: CommandInteraction, registration: RegistrationHandler): Promise<void> {
|
public async show(interaction: CommandInteraction, registration: RegistrationHandler): Promise<void> {
|
||||||
const discordUser = interaction.user
|
const discordUser: GuildMember = <GuildMember>interaction.member
|
||||||
if (!discordUser.username || discordUser.username == "") {
|
const result = registration.getNameRegisteredForDiscordUser(discordUser)
|
||||||
await interaction.reply(`This user does not seem to have a username, can't search`)
|
await interaction.reply(JSON.stringify(result, null, 2))
|
||||||
} else {
|
|
||||||
const result = registration.getNameRegisteredForDiscordUser(discordUser.username)
|
|
||||||
await interaction.reply(JSON.stringify(result, null, 2))
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user