techlift-tech / TelegramBotForPokerAnalysis

0 stars 0 forks source link

Incoming Messages Keywords and Flow #7

Open palashjhabak opened 3 years ago

palashjhabak commented 3 years ago

So we want to only address a few fix type of incoming messages/questions/updates. There will be one of two types of messages from users to the bot, first will be just to get information. Second will be to add/update something in our backend related to some user etc. Following will be the exhaustive list of things which we should be able to do and as a result handle all the incoming messages related to those scenarios

disha-2401 commented 3 years ago
disha-2401 commented 3 years ago
palashjhabak commented 3 years ago
  • We can have the main command of a multi-step scenario
  • For example, to get the profit/loss of a single user we can have the main command as "/GetProfit" when the user types this command bot will show him all users under him so that he can select which user's profit/loss he wants to check.
  • Now to display all the users we can have a InlineKeyboardMarkup or ReplyKeyboardMarkup so that all users are displayed in form of buttons.
  • Better option would be to create a inline keyboard because we can delete the displayed keyboard as soon as user press a button.
  • After user selection we can get and send profit/loss of selected user by admin.

Good points. yes keyboard markup will be a better idea as we might have 10 or 15 users also under an admin so replay keyboard markup might not fit so many users unless it has scroll.

disha-2401 commented 3 years ago

we could just register our commands for better user access so that the user can select from given commands rather than typing them. For that, we have to contact bot father to register our commands. my suggestion would be to create 8 commands for these scenarios such as : -

  1. /weekprofitall - to get this week's profit/loss of all users under an admin
  2. /weekprofit - to get this week's profit/loss of a user
  3. /todayprofitall - to get today's profit/loss of all users under an admin
  4. /todayprofit - to get today's profit/loss of a user
  5. /remaininglimitall - to get this week's remaining limit of all users under an admin
  6. /remaininglimit - to get this week's remaining limit of a user
  7. /setlimittoday - to set today's limit of a user
  8. /setlimitweek - set week's limit of a user

we can not use the pascal case when registering commands via bot father.

palashjhabak commented 3 years ago

we could just register our commands for better user access so that the user can select from given commands rather than typing them. For that, we have to contact bot father to register our commands. my suggestion would be to create 8 commands for these scenarios such as : -

  1. /weekprofitall - to get this week's profit/loss of all users under an admin
  2. /weekprofit - to get this week's profit/loss of a user
  3. /todayprofitall - to get today's profit/loss of all users under an admin
  4. /todayprofit - to get today's profit/loss of a user
  5. /remaininglimitall - to get this week's remaining limit of all users under an admin
  6. /remaininglimit - to get this week's remaining limit of a user
  7. /setlimittoday - to set today's limit of a user
  8. /setlimitweek - set week's limit of a user

we can not use the pascal case when registering commands via bot father.

Nice. But let's say when user selects /weekprofit how will the user pass the for which user do we want to get the profit for? I assume when user selects /weekprofit you will then return a list of users? Another way could be to just have one command /weekprofit instead of two commands and when user selects /weekprofit, we return a list of users and "All" button at the top. What say?

disha-2401 commented 3 years ago

we could just register our commands for better user access so that the user can select from given commands rather than typing them. For that, we have to contact bot father to register our commands. my suggestion would be to create 8 commands for these scenarios such as : -

  1. /weekprofitall - to get this week's profit/loss of all users under an admin
  2. /weekprofit - to get this week's profit/loss of a user
  3. /todayprofitall - to get today's profit/loss of all users under an admin
  4. /todayprofit - to get today's profit/loss of a user
  5. /remaininglimitall - to get this week's remaining limit of all users under an admin
  6. /remaininglimit - to get this week's remaining limit of a user
  7. /setlimittoday - to set today's limit of a user
  8. /setlimitweek - set week's limit of a user

we can not use the pascal case when registering commands via bot father.

Nice. But let's say when user selects /weekprofit how will the user pass the for which user do we want to get the profit for? I assume when user selects /weekprofit you will then return a list of users? Another way could be to just have one command /weekprofit instead of two commands and when user selects /weekprofit, we return a list of users and "All" button at the top. What say?

yes that would be a better option, this way we only need to create 4 commands

palashjhabak commented 3 years ago

we could just register our commands for better user access so that the user can select from given commands rather than typing them. For that, we have to contact bot father to register our commands. my suggestion would be to create 8 commands for these scenarios such as : -

  1. /weekprofitall - to get this week's profit/loss of all users under an admin
  2. /weekprofit - to get this week's profit/loss of a user
  3. /todayprofitall - to get today's profit/loss of all users under an admin
  4. /todayprofit - to get today's profit/loss of a user
  5. /remaininglimitall - to get this week's remaining limit of all users under an admin
  6. /remaininglimit - to get this week's remaining limit of a user
  7. /setlimittoday - to set today's limit of a user
  8. /setlimitweek - set week's limit of a user

we can not use the pascal case when registering commands via bot father.

Nice. But let's say when user selects /weekprofit how will the user pass the for which user do we want to get the profit for? I assume when user selects /weekprofit you will then return a list of users? Another way could be to just have one command /weekprofit instead of two commands and when user selects /weekprofit, we return a list of users and "All" button at the top. What say?

yes that would be a better option, this way we only need to create 4 commands

yes. so /weekProfit /todaysProfit /remainingLimit /setLimit

disha-2401 commented 3 years ago

we can also set commands using SetMyCommandsAsync

disha-2401 commented 3 years ago

it would be better if we use SetMyCommandsAsync method.

palashjhabak commented 3 years ago

it would be better if we use SetMyCommandsAsync method.

so we whenever our service starts we will checkout all the registered commands with telegram and if there is any command in our service which is not registered we call SetMyCaommandsAsync method. What do you think? Also what is the function to get already registered commands?

disha-2401 commented 3 years ago

it would be better if we use SetMyCommandsAsync method.

so we whenever our service starts we will checkout all the registered commands with telegram and if there is any command in our service which is not registered we call SetMyCommandsAsync method. What do you think? Also what is the function to get already registered commands?

to get registered commands we can use GetMyCommandsAsync() method. example as : -

var commands = botClient.GetMyCommandsAsync().Result[0];
Console.WriteLine(commands.Command);
disha-2401 commented 3 years ago

so I've added code that gets agency object if user types '/todays_profit', based on agency Id it gets all users under that agent id. also based on the number of users we send an InlineKeyboardMarkup of all users in form of buttons plus an extra button for all users. tell me if it's right then I'll write code for all commands.

disha-2401 commented 3 years ago

@palashjhabak do we have access to remote API? I've written enough code to test that API. it would be easy to test code if we have access. also, "GET /api​/Agency​/{telegramId}" here {telegramId} means telegram userId right?

palashjhabak commented 3 years ago

@disha-2401 so the APIs are not ready yet, but you should keep pushing your code and raise pull requests so that I can have a look at it and add my reviews in the meantime and when the APIs are rwad to use you can test it then