
Security News
Nx npm Packages Compromised in Supply Chain Attack Weaponizing AI CLI Tools
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
$ gem install edi
edi is an application framework for building Chat bots to integrate with your Slack chat room. It ships with a number of useful and funny built-in services, but it also provides and easy DSL for creating your own services.
Creating a chatbot is as easy as:
$ edi new my-bot
bot/core.rb
is the main brain of your edi bot. Here you can register which services you want to be available on your chatbot.
class Core < EDI::Core
register_services :tweet_that, :img_flip, :urban_dictionary, :weather, :joke
end
These are the services that will be enabled when edi interprets a message from Slack.
If a Service integrates with an authenticated, third party API, you may need to set up environment variables for API Tokens, Secrets, Usernames and Passwords, etc. To ensure that services are not run in environments that aren't set up to support them, services can require certain variables be set up.
class MyService < EDI::Service
environment :service_token, :service_secret
end
If a service is Registered in bot/core.rb
but does not have it's expected environment, edi will throw an exception and respond with a polite refusal to execute the service. This message can be set in your EDI configuration. The enviornment method will also create a getter method for each environment variable.
There are two ways to tell edi to send a given message to a particular service.interpreter_pattern
and phrases
class ImgFlip < EDI::Service
phrases "success kid", "overly attached girlfriend"
# will converted to a pattern that looks like /success kid|overly attached girlfriend/i
end
class SortingHat < EDI::Service
interpreter_pattern /sorting hat|where do I belong/i
end
Setting interpreter pattern directly will take precendence over phrases if you include both.
Services should expose a run
method. This method will perform whatever actions necessary to fulfill the service and should ultimately return the string that edi will send back to the channel in slack.
A very simple service might look like:
class SortingHat < EDI::Service
def run
[
"Gryphondor, where dwell the brave of heart!",
"Slytherine, because you are kind of a jerk"
].sample
end
end
If you want to use a more semantic name for your service, you can override the method using invoke_with
class IJustMetYou < EDI::Service
invoke_with :call_me_maybe
def call_me_maybe
"This is crazy, but here's my number, so call me maybe"
end
end
You can do actions before or after the service is run, but before edi responds. For instance:
class Joke < EDI::Service
before_invoke :setup
invoke_with :punch
def setup
EDI.send_message("What do you call a fish with no eyes?", channel: channel)
sleep 2
end
def punch
"A FSH!"
end
end
Since EDI is, under the hood, a web socket client, it can be deployed to any internet connected computer, and does not require a web server. Simple run
$ edi start
And EDI will connect to slack and will stay connected for the life of the process.
When these things are done, we'll be ready for 1.0
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that edi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.