public async Task AddNotify(string domain, string channel, params string[] name) { if (!MentionUtils.TryParseChannel(channel, out ulong channelId)) { await ReplyAsync($"{Context.User.Mention} can not parse this as discord channel: `{channel}`"); return; } if (!(Context.Client.GetChannelAsync(channelId).Result is ITextChannel)) { await ReplyAsync($"{Context.User.Mention} this is not text channel: `{channel}`"); return; } var vkObj = _vk.ResolveScreeName(domain); if (vkObj == null) { await ReplyAsync($"{Context.User.Mention} can not find this: `{domain}`"); return; } if (vkObj.Type != VkObjectType.Group && vkObj.Type != VkObjectType.User) { await ReplyAsync($"{Context.User.Mention} this is not group or user: `{domain}`"); return; } var notify = new Notify() { LastSent = DateTime.Now, LastCheck = DateTime.Now, Info = new NotifyInfo { Hidden = false, Type = NotifyType.UserWall, Name = String.Join(" ", name), SourceDomain = domain, SourceId = vkObj.Id, ChannelId = channelId, SendsPerNotify = Convert.ToUInt16(DataManager.BotSettings.DefaultSentPostsCount), UpdatePeriod = Convert.ToUInt16(DataManager.BotSettings.DefaultUpdatePeriod), WithHeader = true, WithAudio = true, WithDocument = true, WithMap = true, WithPhoto = true, WithPool = true, WithText = true, WithVideo = true, SearchString = null, Comment = null, } }; if (vkObj.Type != VkObjectType.User) { notify.Info.SourceId *= -1; notify.Info.Type = NotifyType.GroupWall; } _notify.AddNotifyAndStart(Context.Guild.Id, notify); var message = await ReplyAsync("Okay, i am added"); new Timer((s) => message.DeleteAsync(), null, DataManager.BotSettings.WaitingBeforeDeleteMessage, Timeout.Infinite); }