Example #1
0
        private void DeleteCallbackServer(VkApi api, VkOptions options)
        {
            var server = api.Groups.GetCallbackServers(options.GroupId)
                         .FirstOrDefault(s => string.CompareOrdinal(s.Title, ServerName) == 0);

            if (server != null)
            {
                api.Groups.DeleteCallbackServer(options.GroupId, (ulong)server.Id);
            }
        }
Example #2
0
        private string AddCallbackServer(VkApi api, BotOptions botOptions, VkOptions options)
        {
            var serverId = api.Groups.AddCallbackServer(options.GroupId,
                                                        botOptions.Endpoint + VkConstants.Endpoint,
                                                        "UniBot.Vk",
                                                        null);

            api.Groups.SetCallbackSettings(new CallbackServerParams
            {
                GroupId          = options.GroupId,
                ServerId         = serverId,
                ApiVersion       = api.VkApiVersion as VkApiVersionManager,
                CallbackSettings = new CallbackSettings
                {
                    MessageNew = true,
                }
            });

            return(api.Groups.GetCallbackConfirmationCode(options.GroupId));
        }