Dsharp, edit a bot's message's embed - c#

How can i edit/modify my bot's message's embed Title?
I tried this:
"await botMessage.ModifyAsync(NewEmbed).ConfigureAwait(false);"
but i got an error "NewEmbed is not null here" Why does it need to be null if I want to replace it?

Related

Telegram Bot API C# How to get All Pinned Messages?

Telegram added the feature to pin more than one message. I'm doing it like this:
var chat = botClient.GetChatAsync(chatid).Result;
pinnedmsgtxt = chat.PinnedMessage.Text;
pinnedmsg= chat.PinnedMessage;
but I can only get the last message that was pinned. Any way to get all of them? Am I missing something? I'm using https://github.com/TelegramBots/telegram.bot
Use messages.search method with inputMessagesFilterPinned filter.
Please read more here:
Pin API
Message Search API
Pinned messages filter

Access previous message content from a user reply message on Telegram

Does anyone know how can I access a previous message content when a user sends a reply message on Telegram?
for example:
James: hello
me: reply on James message with "hello friend"
here i want to get the hello message content or its message id in my telegram bot to process a command.
sth like this:
if(message.Contains("/delete")){
bot.DeleteMessageAsync(chatId, PreviousMessage or OriginalMessage ID)
}
PreviousMessage or OriginalMessage ID are equals to MessageId
but instead of MessageId i want to use sth like those two
I have checked telegram bot documentation and I did not find anything
How can i do it?
(Im using getUpdates method)
sorry for my poor English
You can find the original message ID in message.reply_to_message.message_id. Naming could differ depends on the library you use. More information and other attributes that could be useful you can find in the official Telegram's documentation for the Message object.

How to get the previous url in C#?

How to get the previous url in a MasterPage in C# ?
I'm trying to find the page which is redirected from.
Thanks in advance.
You can get information of the previous url with the UrlReferrer property. This works in MVC and Web forms.
Request.UrlReferrer.AbsoluteUri
Note that in the first page the property Request.UrlReferrer will be null. Also, it will be null if a redirection occurs (e.g. when a user logs into the web page).
This property is based on the HTTP_REFERER variable, so you could use this one instead.
Request.ServerVariables["HTTP_REFERER"]
Since the HTTP_REFERER is a variable sent by the client it might be altered or removed by the request. Also, the variable is not set when the referre url starts with https.
This article mentions a few points why the Request.UrlReferrer can be null.
Usually you use a query string parameter to achieve this: current?previousUrl=/some/11.
This will allow you to access this value from the server-side code using Context.Request.QueryString["previousUrl"] in your master page code-behind.
string urlName = Request.UrlReferrer.ToString();

How to add a URL in the message field in Facebook Requests by using facebook api?

I want to include a URL in the message field of Request Dialog. Tried in lots of ways but didn't get a proper solution. Can anyone help me?
FB.ui({
method: 'apprequests',
message: 'For more details CLICK HERE',
});
Where I want to provide the link as in HTML(CLICK HERE)
I think the problem you are facing here is double quotes (") in link breaks the format of string in message so you can use slash ('\') to resolve quotes(") issue like this :
string anc = "CLICK HERE";

How to add a URL in the description field in Facebook by using dialog/feed javascript?

There is a requirement to post messages from our website. I am using the below code for achieving the same.
http://www.facebook.com/dialog/feed?app_id=123050457758183&source =www.google.com& link=www.google.com&picture=http://fbrell.com/f8.jpg& name=Facebook%20Dialogs& caption=Reference%20Documentation& description=Using%20Dialogs%20to%20interact%20with%20users& message=Facebook%20Dialogs%20are%20so%20easy!& redirect_uri=http://www.example.com/response
Everything is working fine. I want to add a URL like "For more information click here - www.somesite.com". I tried to put href in the description body but Facebook does not recognize it as a link.
We have both iOS and HTML5 application and in iOS, it is possible to put link in Description. So was wondering why javascript does not support this.
The below code does the same in iOS.
NSDictionary *propertyValue = [NSDictionary dictionaryWithObjectsAndKeys:#"[(www.somesite.com)]",#"text",#"http://www.somesite.com",#"href", nil];
NSDictionary *properties = [NSDictionary dictionaryWithObjectsAndKeys:propertyValue, #"For more information click here",nil];
Any solution for this?
The JavaScript API does support this, but it's not well documented on the Facebook Developers site. I was finally able to get it working after reading this page:
fbdevwiki.com/wiki/FB.ui
Here's sample of the JavaScript params that worked for me:
var params = {
method: 'feed',
name: 'Name Name Name',
link: 'http://www.website.com/',
picture: http://www.website.com/yourimage,
caption: 'Caption Caption Caption',
description: 'Get it from iTunes today',
properties: {'Download Free':{ text: 'My Fancy App', href: 'http://www.itunes.com/'}},
actions: [{name: 'Free iTunes Download', link: 'http://www.itunes.com/'}]
};
The "actions" parameter adds a link down by the "like" and "comment" links at the bottom of the post.
No, you can't have links to description or caption (you can place URL here but it wouldn't be link) and message property is deprecated (and even removed from documentation of Feed Dialog).
Instead you should use link property so name of the post will be pointing to.
BTW, Even if you will use Graph API to post content without showing it to user and add URL in the message it will not be displayed as link in most places user can see it. (beware that message is something that should be written by user, or it will be probably violation of Platform Policies)

Categories