Added trycatches to addcrowduser
This commit is contained in:
parent
5c50095558
commit
f9d6ed82e9
@ -12,10 +12,8 @@ const addcrowduser = new Command(
|
||||
|
||||
const username = firstNameLetter + lastName;
|
||||
const password = lastName + firstNameLetter;
|
||||
console.log(username);
|
||||
console.log(password);
|
||||
|
||||
|
||||
try {
|
||||
await got.post("https://conjure.etsmtl.ca/crowd/rest/usermanagement/1/user", {
|
||||
responseType: 'json',
|
||||
username: crowd.username,
|
||||
@ -34,7 +32,13 @@ const addcrowduser = new Command(
|
||||
"last-name": args[2]
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error.response.body);
|
||||
message.channel.send("Couldn't add the new member.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await got.post("https://conjure.etsmtl.ca/crowd/rest/usermanagement/1/user/group/direct", {
|
||||
responseType: 'json',
|
||||
username: crowd.username,
|
||||
@ -49,8 +53,13 @@ const addcrowduser = new Command(
|
||||
['username', username]
|
||||
])
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error.response.body);
|
||||
message.channel.send("Couldn't add the user to conjure-member.");
|
||||
return;
|
||||
}
|
||||
|
||||
message.channel.send("Member added.");
|
||||
message.channel.send(`Member added.\nUsername: ${username}\nPassword: ${password}`);
|
||||
}, {
|
||||
description: "Adds a member to Crowd.",
|
||||
permissions: [userDict.misabiko, userDict.massimo],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user