Skip to content

Commit

Permalink
Allow longs for setting IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
Chew committed Nov 1, 2021
1 parent 6190a3d commit 547cc63
Showing 1 changed file with 49 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.jagrosh.jdautilities.command;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.function.Consumer;

Expand Down Expand Up @@ -100,7 +101,23 @@ public CommandClientBuilder setOwnerId(String ownerId)
this.ownerId = ownerId;
return this;
}


/**
* Sets the owner for the bot.
* <br>Make sure to verify that the ID provided is ISnowflake compatible when setting this.
* If it is not, this will warn the developer.
*
* @param ownerId
* The ID of the owner.
*
* @return This builder
*/
public CommandClientBuilder setOwnerId(long ownerId)
{
this.ownerId = String.valueOf(ownerId);
return this;
}

/**
* Sets the one or more CoOwners of the bot.
* <br>Make sure to verify that all of the IDs provided are ISnowflake compatible when setting this.
Expand All @@ -116,7 +133,23 @@ public CommandClientBuilder setCoOwnerIds(String... coOwnerIds)
this.coOwnerIds = coOwnerIds;
return this;
}


/**
* Sets the one or more CoOwners of the bot.
* <br>Make sure to verify that all of the IDs provided are ISnowflake compatible when setting this.
* If it is not, this will warn the developer which ones are not.
*
* @param coOwnerIds
* The ID(s) of the CoOwners
*
* @return This builder
*/
public CommandClientBuilder setCoOwnerIds(long... coOwnerIds)
{
this.coOwnerIds = Arrays.stream(coOwnerIds).mapToObj(String::valueOf).toArray(String[]::new);
return this;
}

/**
* Sets the bot's prefix.
* <br>If set null, empty, or not set at all, the bot will use a mention {@literal @Botname} as a prefix.
Expand Down Expand Up @@ -395,6 +428,20 @@ public CommandClientBuilder forceGuildOnly(String guildId)
return this;
}

/**
* Forces Guild Only for SlashCommands.
* This is the same as setting this.guildOnly = true and this.guildId = your value for every command.
* Setting this to null disables the feature, but it is off by default.
*
* @param guildId the guild ID.
* @return This Builder
*/
public CommandClientBuilder forceGuildOnly(long guildId)
{
this.forcedGuildId = String.valueOf(guildId);
return this;
}

/**
* Whether or not to manually upsert slash commands.
* This is designed if you want to handle upserting, instead of doing it every boot.
Expand Down

0 comments on commit 547cc63

Please sign in to comment.