示例#1
0
        /// <inheritdoc />
        public virtual async Task <IGuild> CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon = null)
        {
            var args  = new CreateGuildParams();
            var model = await ApiClient.CreateGuildAsync(args).ConfigureAwait(false);

            return(new Guild(this, model));
        }
示例#2
0
        public static async Task <RestGuild> CreateGuildAsync(BaseDiscordClient client,
                                                              string name, IVoiceRegion region, Stream jpegIcon, RequestOptions options)
        {
            var args  = new CreateGuildParams(name, region.Id);
            var model = await client.ApiClient.CreateGuildAsync(args, options).ConfigureAwait(false);

            return(RestGuild.Create(client, model));
        }
示例#3
0
        public static async Task <RestGuild> CreateGuildAsync(BaseDiscordClient client,
                                                              string name, IVoiceRegion region, Stream jpegIcon, RequestOptions options)
        {
            CreateGuildParams args = new CreateGuildParams(name, region.Id);

            if (jpegIcon != null)
            {
                args.Icon = new API.Image(jpegIcon);
            }

            API.GuildJson model = await client.ApiClient.CreateGuildAsync(args, options).ConfigureAwait(false);

            return(RestGuild.Create(client, model));
        }
 /// <inheritdoc />
 async Task <IGuild> IDiscordClient.CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon, RequestOptions options)
 => await CreateGuildAsync(name, region, jpegIcon, options).ConfigureAwait(false);
 public Task <RestGuild> CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon = null, RequestOptions options = null)
 => ClientHelper.CreateGuildAsync(this, name, region, jpegIcon, options);
示例#6
0
 Task <IGuild> IDiscordClient.CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon)
 {
     throw new NotSupportedException();
 }
示例#7
0
 /// <inheritdoc />
 public async Task <IGuild> CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon = null, RequestOptions options = null)
 => (await(BaseDiscordClient as IDiscordClient).CreateGuildAsync(name, region, jpegIcon, options))
 .Abstract();
示例#8
0
 /// <summary>
 /// Converts an existing <see cref="IVoiceRegion"/> to an abstracted <see cref="IVoiceRegion"/> value.
 /// </summary>
 /// <param name="voiceRegion">The existing <see cref="IVoiceRegion"/> to be abstracted.</param>
 /// <exception cref="ArgumentNullException">Throws for <paramref name="voiceRegion"/>.</exception>
 /// <returns>An <see cref="IVoiceRegion"/> that abstracts <paramref name="voiceRegion"/>.</returns>
 public static IVoiceRegion Abstract(this IVoiceRegion voiceRegion)
 => voiceRegion switch
 {
     null
     => throw new ArgumentNullException(nameof(voiceRegion)),
 public static string GetString(this IVoiceRegion region)
 => $"'{region.Name}' ({region.Id})";
示例#10
0
 public Task <IGuild> CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon = null, RequestOptions options = null)
 {
     throw new System.NotImplementedException();
 }
示例#11
0
 /// <inheritdoc />
 new public async Task <IRestGuild> CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon, RequestOptions options)
 => RestGuildAbstractionExtensions.Abstract(
     await BaseSocketClient.CreateGuildAsync(name, region, jpegIcon, options));
示例#12
0
 /// <inheritdoc />
 new public async Task <IRestGuild> CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon, RequestOptions options)
 => (await DiscordRestClient.CreateGuildAsync(name, region, jpegIcon, options))
 .Abstract();
示例#13
0
 public Task <IGuild> CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon = null, RequestOptions options = null)
 {
     throw new InvalidOperationException();
 }
 public virtual Task <IGuild> CreateGuildAsync(string name, IVoiceRegion region, Stream?jpegIcon = null, RequestOptions?options = null)
 {
     return(((IDiscordClient)_baseDiscordClient).CreateGuildAsync(name, region, jpegIcon, options));
 }