コード例 #1
0
        internal static SocketGroupChannel GetSocketGroupChannel(IGroupChannel channel)
        {
            Preconditions.NotNull(channel, nameof(channel));
            var socketChannel = channel as SocketGroupChannel;

            if (socketChannel == null)
            {
                throw new InvalidOperationException("This extension method is only valid on WebSocket Entities");
            }
            return(socketChannel);
        }
コード例 #2
0
ファイル: IGroupChannel.cs プロジェクト: Scott-Caldwell/MODiX
 /// <summary>
 /// Converts an existing <see cref="IGroupChannel"/> to an abstracted <see cref="IGroupChannel"/> value.
 /// </summary>
 /// <param name="groupChannel">The existing <see cref="IGroupChannel"/> to be abstracted.</param>
 /// <exception cref="ArgumentNullException">Throws for <paramref name="groupChannel"/>.</exception>
 /// <returns>An <see cref="IGroupChannel"/> that abstracts <paramref name="groupChannel"/>.</returns>
 public static IGroupChannel Abstract(this IGroupChannel groupChannel)
 => groupChannel switch
 {
     null
     => throw new ArgumentNullException(nameof(groupChannel)),
コード例 #3
0
 public static IReadOnlyCollection <IUser> GetUsers(this IGroupChannel channel)
 => GetSocketGroupChannel(channel).Users;
コード例 #4
0
 public static IUser GetUser(this IGroupChannel channel, ulong id)
 => GetSocketGroupChannel(channel).GetUser(id);
コード例 #5
0
 public DMChannelViewer(IGroupChannel channel)
 {
     InitializeComponent();
     Channel = channel;
 }
コード例 #6
0
ファイル: Tools.cs プロジェクト: WamWooWam/DiscordWPF
 public static string GetName(this IGroupChannel channel) => channel.Name ?? string.Join(", ", (channel.GetUsersAsync().Flatten().Result).Select(u => u.Username));