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)
|
||||
}
|
||||
public async removeUser(interaction: CommandInteraction, registration: RegistrationHandler): Promise<void> {
|
||||
const discordUser = interaction.user
|
||||
if (!discordUser.username || discordUser.username == "") {
|
||||
await interaction.reply(`This user does not seem to have a username, can't delete`)
|
||||
}
|
||||
else {
|
||||
registration.removeUser(discordUser.username)
|
||||
await interaction.reply(`User has been removed`)
|
||||
}
|
||||
const discordUser: GuildMember = <GuildMember>interaction.member
|
||||
registration.removeUser(discordUser)
|
||||
await interaction.reply(`User has been removed`)
|
||||
return
|
||||
}
|
||||
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')
|
||||
if (!discordUser.username || discordUser.username == "") {
|
||||
await interaction.reply(`This user does not seem to have a username, can't register`)
|
||||
}
|
||||
else if (!steamNameToRegister) {
|
||||
console.dir(discordUser)
|
||||
if (!steamNameToRegister) {
|
||||
await interaction.reply(`No steam name supplied, can't register`)
|
||||
}
|
||||
else {
|
||||
registration.register(discordUser.username, steamNameToRegister)
|
||||
await interaction.reply(`This should register user ${discordUser.username} with id ${discordUser.id} to use steamname: ${steamNameToRegister}`)
|
||||
registration.register(discordUser, steamNameToRegister)
|
||||
await interaction.reply(`This should register user ${discordUser.user.username} with id ${discordUser.user.id} to use steamname: ${steamNameToRegister}`)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -91,13 +84,9 @@ export default class DiscordAdapter {
|
||||
return
|
||||
}
|
||||
public async show(interaction: CommandInteraction, registration: RegistrationHandler): Promise<void> {
|
||||
const discordUser = interaction.user
|
||||
if (!discordUser.username || discordUser.username == "") {
|
||||
await interaction.reply(`This user does not seem to have a username, can't search`)
|
||||
} else {
|
||||
const result = registration.getNameRegisteredForDiscordUser(discordUser.username)
|
||||
await interaction.reply(JSON.stringify(result, null, 2))
|
||||
}
|
||||
const discordUser: GuildMember = <GuildMember>interaction.member
|
||||
const result = registration.getNameRegisteredForDiscordUser(discordUser)
|
||||
await interaction.reply(JSON.stringify(result, null, 2))
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user