Skip to content

Commit

Permalink
fork errors
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewstech committed Jul 9, 2023
1 parent f90eb4f commit e1054f4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions commands/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module.exports = {


const githubUser = await User.findOne({ userid: interaction.user.id });
const username = githubUser.githubid;

const authUrl = auth.getAccessToken(interaction.user.id);
const loginBtn = new ActionRowBuilder().addComponents(new ButtonBuilder().setStyle(ButtonStyle.Link).setLabel("Login with GitHub").setURL(authUrl));
Expand Down
22 changes: 17 additions & 5 deletions components/fork.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,23 @@ const forkRepo = async (token, guild) => {
"X-GitHub-Api-Version": "2022-11-28",
},
});
if (forked.status !== 202) {
console.log("Fork failed");
const ErrorEmbed = new EmbedBuilder().setTitle(`Registering ${subdomain}.is-a.dev`).setDescription(`Fork failed!`).addFields({ name: "Forked", value: "❌", inline: true }, { name: "Commited", value: "❌", inline: true }, { name: "PR Opened", value: "❌", inline: true }).setColor("#FF0000").setFooter({
text: "is-a.dev",
iconURL: logo,
});
await interaction.editReply({ embeds: [ErrorEmbed] });
return;
}
else {
const embed = new EmbedBuilder().setTitle(`Registering ${subdomain}.is-a.dev`).addFields({ name: "Forked ", value: "✅", inline: true }, { name: "Commited ", value: "❌", inline: true }, { name: "PR Opened ", value: "❌", inline: true }).setColor("#00b0f4").setFooter({
text: "is-a.dev",
icon_url: guild.logo,
});
await interaction.editReply({ embeds: [embed] });
}

const cloneResponse = forked.data.clone_url;
if (process.env.DEBUG) {
console.log("FORKED REPO: " + cloneResponse);
Expand All @@ -46,11 +63,6 @@ async function fork(id, interaction, subdomain) {
console.log("token: " + token);
}
const responce = await forkRepo(token, guild);
const embed = new EmbedBuilder().setTitle(`Registering ${subdomain}.is-a.dev`).addFields({ name: "Forked ", value: "✅", inline: true }, { name: "Commited ", value: "❌", inline: true }, { name: "PR Opened ", value: "❌", inline: true }).setColor("#00b0f4").setFooter({
text: "is-a.dev",
icon_url: guild.logo,
});
await interaction.editReply({ embeds: [embed] });
return responce;
}
exports.fork = fork;

0 comments on commit e1054f4

Please sign in to comment.