GithubHelp home page GithubHelp logo

Comments (8)

justdmitry avatar justdmitry commented on August 11, 2024

I don't see any requests like self-kicking in Telegram bot api. May be https://core.telegram.org/bots/api#kickchatmember may help, but your bot must be admin in chat.

from nettelegrambotapi.

hanigamini avatar hanigamini commented on August 11, 2024

I want prevent unwanted add my bot in group ,
I want left form that group.
this is method , leaveChat , how can i use it?
https://core.telegram.org/bots/api#leavechat

from nettelegrambotapi.

justdmitry avatar justdmitry commented on August 11, 2024

I can't find something in Telegram bot API docs that may help you.

Any bot may be added in any chat. You may start replying on every message in chat with some spam and humans will remove your bot very quickly ;)

from nettelegrambotapi.

hanigamini avatar hanigamini commented on August 11, 2024

leaveChat , how can i use it?
https://core.telegram.org/bots/api#leavechat

from nettelegrambotapi.

justdmitry avatar justdmitry commented on August 11, 2024

Wow, my eyes. You are right, that's exactly what you need.

So, just send 'LeaveChat`:

var chatToLeave = message.Chat.Id;
await bot.SendAsync(chatToLeave, new LeaveChat(chatToLeave));

from nettelegrambotapi.

hanigamini avatar hanigamini commented on August 11, 2024

your code not work , whast is the diffrence with this ?
bot.MakeRequestAsync(new LeaveChat(chatToLeave)).Wait();

from nettelegrambotapi.

justdmitry avatar justdmitry commented on August 11, 2024

Ouch, sorry.

I'm not with VS now, writing in "notepad". My code is from NetTelegramBot.Framework, it will not compile in "naked" NetTelegramBotApi.

Your code is correct one and should work.

from nettelegrambotapi.

hanigamini avatar hanigamini commented on August 11, 2024

Thank you very much,
I add try cacth in c# because somtime have error with LeaveChat. and bot is in hanging.
Is there any way for that ?

from nettelegrambotapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.