Skip to content

Commit

Permalink
fixed welcome not adding role
Browse files Browse the repository at this point in the history
  • Loading branch information
vKxni committed Feb 27, 2022
1 parent e1db366 commit 3fd33b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/commands/Setup/Welcome/managewelcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ module.exports.run = async (interaction) => {

if (sub === "setup") {
const isSetup = await Guild.findOne({ id: interaction.guild.id });
const channel =
interaction.options.getChannel("channel") || interaction.channel;
const channel = interaction.options.getChannel("channel") || interaction.channel;
const role = interaction.options.getRole("role");

if (!isSetup) {
if (channel.type != "GUILD_TEXT") {
Expand All @@ -38,6 +38,7 @@ module.exports.run = async (interaction) => {

const newAuctions = new Guild({
id: interaction.guild.id,
role: role.id,
channel: channel.id,
});
newAuctions.save();
Expand All @@ -48,6 +49,7 @@ module.exports.run = async (interaction) => {
} else {
await Guild.findOneAndUpdate({
id: interaction.guild.id,
role: role.id,
channel: channel.id,
});
interaction.followUp({
Expand Down
4 changes: 0 additions & 4 deletions src/models/Welcome/welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@ const welcomeSchema = new Schema({
id:
{
type: String,
unique: true,
required: true
},
role:
{
type: String,
required: false
},
channel:
{
type: String,
required: true
},
}, { timestamps: true });

Expand Down

0 comments on commit 3fd33b2

Please sign in to comment.