matt-github-acct / dotnetcore-slackbot Goto Github PK
View Code? Open in Web Editor NEW.Net Core Slackbot Library
License: MIT License
.Net Core Slackbot Library
License: MIT License
One comment - when the socket gets disconnected it will throw an exception and in the catch block the connect method is called again. Looks like this would cycle very quickly when no internet connection was available.
After some seconds, the following exception is throwed:
System.ArgumentNullException: Value cannot be null.
Parameter name: uriString
at Slackbot.SocketConnection.TryConnect()
at Slackbot.SocketConnection.Connect()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__7_1(Object state)
at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.QueueUserWorkItemCallback.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
The current code is the same of the example:
var bot = new Bot(name, token);
bot.OnMessage += (sender, message) =>
{
if (message.MentionedUsers.Any(m => m == name))
bot.SendMessage(message.Channel, $"Hi {message.User}, thanks for mentioning my name!");
};
I running it on .NET Core 2.1 (04e15494b6), the Slackbot library version is 1.4.1.
Hey, great project it's really easy to get started.
Do you think it's possible to add attachment support?
Thanks
This would allow me to create a bot before connecting to the service. I would like to do some configuration and dependency injection in my app before actually starting (Connecting) the bot.
Proposed change
public class Bot
{
public Bot(string token, string username, bool connect = true)
{
//existing initialization
if(connect)
{
Connect();
}
}
public void Start()
{
Connect():
}
}
Example call
var shouldConnectNow = false;
var bot = new Bot(botName, botToken, shouldConnectNow);
//do other things
bot.Start();
In OnMessage event, include sender of message.
This library suppresses message events when the event is a message edit. Is this desirable behavior? Should the edit event not be suppressed?
Hello, i'm getting this exception whenever i launch the program :
System.PlatformNotSupportedException : 'The WebSocket protocol is not supported on this platform.'
It turns out that System.Net.WebSockets is not supported on windows 7. I cannot update windows on my work laptop, is there any chance that you fix this problem soon? I heard that Fleck can solve this trivially : "http://stackoverflow.com/a/15679366"
Hi, I'm running your bot in LinqPad, but am getting an NRE when it hears a message. I think the error is on a background thread, which LinqPad is catching automatically, but it might cause issies on other hosts.
The bot still seems to work, but it's maybe only because LinqPad catches the error safely
PS your bot is awesome I've got lots of people at work using it on a hackday :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.