diff --git a/src/main/java/net/dv8tion/jda/api/entities/channel/ChannelType.java b/src/main/java/net/dv8tion/jda/api/entities/channel/ChannelType.java index 22b332b133..5177dab0ad 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/channel/ChannelType.java +++ b/src/main/java/net/dv8tion/jda/api/entities/channel/ChannelType.java @@ -28,69 +28,82 @@ public enum ChannelType /** * A {@link TextChannel TextChannel}, Guild-Only. */ - TEXT(0, 0, true), + TEXT(TextChannel.class, 0, 0, true), /** * A {@link PrivateChannel PrivateChannel}. */ - PRIVATE(1, -1), + PRIVATE(PrivateChannel.class, 1, -1), /** * A {@link VoiceChannel VoiceChannel}, Guild-Only. */ - VOICE(2, 1, true), + VOICE(VoiceChannel.class, 2, 1, true), /** * A Group. (unused) */ - GROUP(3, -1), + GROUP(GroupChannel.class, 3, -1), /** * A {@link Category Category}, Guild-Only. */ - CATEGORY(4, 2, true), + CATEGORY(Category.class, 4, 2, true), /** * A {@link NewsChannel NewsChannel}, Guild-Only. */ - NEWS(5, 0, true), + NEWS(NewsChannel.class, 5, 0, true), /** * A {@link StageChannel StageChannel}, Guild-Only. */ - STAGE(13, 1, true), + STAGE(StageChannel.class, 13, 1, true), - GUILD_NEWS_THREAD(10, -1, true), - GUILD_PUBLIC_THREAD(11, -1, true), - GUILD_PRIVATE_THREAD(12, -1, true), + GUILD_NEWS_THREAD(ThreadChannel.class, 10, -1, true), + GUILD_PUBLIC_THREAD(ThreadChannel.class, 11, -1, true), + GUILD_PRIVATE_THREAD(ThreadChannel.class, 12, -1, true), /** * A {@link net.dv8tion.jda.api.entities.channel.concrete.ForumChannel ForumChannel}, Guild-Only. */ - FORUM(15, 0, true), + FORUM(ForumChannel.class, 15, 0, true), /** * A {@link MediaChannel}, Guild-Only. */ - MEDIA(16, 0, true), + MEDIA(MediaChannel.class, 16, 0, true), /** * Unknown Discord channel type. * *

This might be used in the case when a channel is not available in cache, like when sending webhook messages. */ - UNKNOWN(-1, -2); + UNKNOWN(Channel.class, -1, -2); private final int sortBucket; private final int id; private final boolean isGuild; + private final Class clazz; - ChannelType(int id, int sortBucket) + ChannelType(Class clazz, int id, int sortBucket) { - this(id, sortBucket, false); + this(clazz, id, sortBucket, false); } - ChannelType(int id, int sortBucket, boolean isGuild) + ChannelType(Class clazz, int id, int sortBucket, boolean isGuild) { + this.clazz = clazz; this.id = id; this.sortBucket = sortBucket; this.isGuild = isGuild; } + /** + * The interface this channel type corresponds to. + * + * @return This channel type's interface + */ + @Nonnull + public Class getInterface() + { + return this.clazz; + } + /** * The sorting bucket for this channel type. * diff --git a/src/main/java/net/dv8tion/jda/api/entities/channel/concrete/GroupChannel.java b/src/main/java/net/dv8tion/jda/api/entities/channel/concrete/GroupChannel.java new file mode 100644 index 0000000000..acec1d8433 --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/entities/channel/concrete/GroupChannel.java @@ -0,0 +1,28 @@ +/* + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.api.entities.channel.concrete; + +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; + +/** + * Represents a Group DM channel. + * + *

This is currently unused. + */ +public interface GroupChannel extends MessageChannel +{ +}