Comments (8)
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.
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.
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.
leaveChat , how can i use it?
https://core.telegram.org/bots/api#leavechat
from nettelegrambotapi.
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.
your code not work , whast is the diffrence with this ?
bot.MakeRequestAsync(new LeaveChat(chatToLeave)).Wait();
from nettelegrambotapi.
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.
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)
- How to display the preview of received information (C# code correction request) HOT 1
- AnswerInlineQuery in NetTelegramBotApi HOT 3
- Chat type response from GetChat has missing properties
- Call back query HOT 3
- Dynamic Inline keyboards HOT 5
- SSL/TLS secure channel issue HOT 1
- Delete Message from group HOT 2
- getFile give an error in webhook mode
- User in group HOT 2
- All Group Message HOT 2
- Bot Messages HOT 2
- Add member HOT 1
- Add member to group HOT 1
- Know that user join a channel HOT 5
- Related to issue #71 HOT 5
- MTProto Proxies HOT 7
- TLS 1.2 issue HOT 4
- Bot is saving received pictures as .tmp HOT 1
- The bot stops responding to messages HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nettelegrambotapi.