|
You should talk to the people who created it - they should provide technical support and will know more about their product than we will. If they don't, then find another supplier and demand your money back!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
I want to do a telegram bot that answers messages and get updates. I created web application on Visual Studio 2015 Express. I write my codes to global.asax. I have installed Telegram.Bot package. I can run the program but program doesn't anything. What may be the problem? Thanks for asistance.
My codes are below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Threading;
using System.Threading.Tasks;
using System.Net;
using Telegram.Bot;
using Telegram.Bot.Args;
using Telegram.Bot.Types;
using Telegram.Bot.Types.Enums;
using Telegram.Bot.Types.ReplyMarkups;
using System.IO;
namespace EC
{
public class Global : System.Web.HttpApplication
{
Telegram.Bot.TelegramBotClient Bot = new TelegramBotClient("xxxxxx");
protected void Application_Start()
{
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Bot.OnMessage += Bot_OnMessage;
Bot.OnUpdate += Bot_OnUpdate;
Bot.StartReceiving();
}
private void Bot_OnMessage(object sender, MessageEventArgs messageEventArgs)
{
var message = messageEventArgs.Message;
if (message == null || message.Type != MessageType.Text) return;
if (message.Text.Contains("/start"))
{
string Str = "Start Received";
Bot.SendTextMessageAsync(message.Chat.Id, Str);
}
else if (message.Text.Contains("/Stop"))
{
string Str = "Stop Received";
Bot.SendTextMessageAsync(message.Chat.Id, Str);
}
}
}
|
|
|
|
|
I would suggest starting here, Introduction - Telegram Bots[^]
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Message Closed
modified 16-Jul-20 1:06am.
|
|
|
|
|
Congratulations on this achievement. You might want to post this in the Lounge instead. This page is for asking questions about C# problems.
|
|
|
|
|
Pete's right - this is the wrong place, The Lounge[^] is where this belongs.
And it's a pity you decided to learn Python ... C# would have been a lot better (I hate Python because of the indentation which can cause massive problems as spaces and tabs aren't equivelant, and all languages where the type of a variable depends on what you last stuffed into it). C#is stricter, but that's actually a bonus because it spots more problems at compile time rather than leave them to crash your app at run time.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I'm tryinig to recurse through the objects under a specific Organization Unit.
string domain = "LDAP://DC=MyCompany,DC=com";
string serverName = "192.168.30.10";
string ou = "OU=OrgUnit-Test-1,DC=MyCompany,DC=com";
I already know that under the OU above there are other OU's, Groups, and users. Each child OU can have groups and users, and each group can have users. It's a hierarchy of info that I want to interate over.
All the examples I'm finding are about finding users in groups and the like. What I'ds really like is some way of looping over some objects to examine them.
Here's an example I have that finds users in a specific group:
<pre>public List<ActiveDirectoryUser> GetAllUsersInGroup(string domainName, string groupName)
{
List<ActiveDirectoryUser> results = new List<ActiveDirectoryUser>();
using (var context = new PrincipalContext(ContextType.Domain, domainName))
{
using (var group = GroupPrincipal.FindByIdentity(context, groupName))
{
if (group != null)
{
var users = group.GetMembers(true).ToList();
foreach (UserPrincipal user in users)
{
var adu = new ActiveDirectoryUser(user.DisplayName, user.UserPrincipalName, user.GivenName, user.Surname, user.EmailAddress, user.Enabled.Value);
results.Add(adu);
}
}
}
}
return results;
}
This works fine - if you know the group name.
Is there any way, given a starting OU, to examine all child objects under it? Again, I need to examine the entire hierarchy.
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
modified 13-Jul-20 16:37pm.
|
|
|
|
|
Does this SO answer help?
c# - Get Groups From OU using DirectoryServices.AccountManagement - Stack Overflow[^]
using (var yourOU = new PrincipalContext(ContextType.Domain, "mycompany.local", "OU=Marketing,OU=Operations,OU=Applications,DC=mycompany,DC=local"))
using (var findAllGroups = new GroupPrincipal(yourOU, "*"))
using (var ps = new PrincipalSearcher(findAllGroups))
{
foreach(var group in ps.FindAll())
{
...
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: Does this SO answer help?
Only partly. I already have something like this that gives back groups for an OU. What's missing is child OU's. An OU can havee other OU's under it.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
active directory - How to get list of OU using AccountManagement (C#) - Stack Overflow[^]
You can extend the GroupPrincipal to search for OUs:
[DirectoryRdnPrefix("OU")]
[DirectoryObjectClass("organizationalUnit")]
public class OuPrincipal : GroupPrincipal
{
public OuPrincipal(PrincipalContext context) : base(context)
{
}
} You should then be able to use this in a similar way to the other code to find the child OUs.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
which website learn and solution C# window Application >
|
|
|
|
|
Um. This one?
Sorry, but your question is so vague that we can't really give any other answer (except "try Google.com", and you probably used that one to find this one ...)
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I thought: how does he come up with a handle like "knowledge share"; then I realized it was "knowedge"
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
|
None of them. The quickest way to learn is going to be books.
Websites just don't convey the level of detail and expansive coverage of the subject the way books do.
|
|
|
|
|
And the worst way is via YouTube. Even "get a copy of VS and start guessing the syntax" is better than most of them...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
|
Straightforward question for you gurus
AddressOrDNSName = "The dynamic DNS name given by my ASUS router"
This works perfectly on my Win 10 laptop connected with wifi to my LAN
IPAddress ipaddress = Dns.GetHostAddresses(AddressOrDNSName).FirstOrDefault();
But errors on my Win 10 Surface Pro connected with WiFi to my LAN with "No such host is known"
WTF ?
"We can't stop here - this is bat country" - Hunter S Thompson - RIP
|
|
|
|
|
Are you sure the Surface Pro is configured correctly for Dns?
|
|
|
|
|
It's strange Richard because I can ping it from the command line on the Surface - what do you mean by configured correctly for DNS ?
"We can't stop here - this is bat country" - Hunter S Thompson - RIP
|
|
|
|
|
Sorry Pete my mistake, I was thinking in pre-WiFi terms. DNS is managed in the router.
|
|
|
|
|
Try querying / refreshing the "arp cache".
arp | Microsoft Docs
And Ipconfig refreshes DHCP/DNS settings.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
modified 12-Jul-20 13:01pm.
|
|
|
|
|
The code below is for dicovering Logitech Media Servers running on my LAN
It works perfectly unless I have a server listening on the same pc ( Windows 10 ) as this code is running on.
It fails with "Only one usage of each socket address is normally allowed"
I have several of these servers running on my LAN and if I stop the one on my pc they are all found without error
int UDPPORT = 3483;
IPEndPoint ReceiveIP = new IPEndPoint(IPAddress.Broadcast,UDPPORT);
UdpClient ClientListener = new UdpClient(UDPPORT);
any ideas guys ?
"We can't stop here - this is bat country" - Hunter S Thompson - RIP
modified 10-Jul-20 8:18am.
|
|
|
|