
Security News
Node.js Moves Toward Stable TypeScript Support with Amaro 1.0
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
github.com/0mili/redis-memory
Integrating mili with Redis. https://github.com/0mili/mili
This repository contains a module for the mili Bot library.
This library is packaged as Go module. You can get it via:
go get github.com/0mili/redis-memory
In order to connect your bot to Redis you can simply pass it as module when creating a new bot:
package main
import (
"github.com/0mili/mili"
"github.com/0mili/redis-memory"
"github.com/pkg/errors"
)
type ExampleBot struct {
*mili.Bot
}
func main() {
b := &ExampleBot{
Bot: mili.New("example",
redis.Memory("localhost:6379"),
),
}
b.Respond("remember (.+) is (.+)", b.Remember)
b.Respond("what is (.+)", b.WhatIs)
b.Respond("show keys", b.ShowKeys)
err := b.Run()
if err != nil {
b.Logger.Fatal(err.Error())
}
}
func (b *ExampleBot) Remember(msg mili.Message) error {
key, value := msg.Matches[0], msg.Matches[1]
msg.Respond("OK, I'll remember %s is %s", key, value)
return b.Store.Set(key, value)
}
func (b *ExampleBot) WhatIs(msg mili.Message) error {
key := msg.Matches[0]
var value string
ok, err := b.Store.Get(key, &value)
if err != nil {
return errors.Wrapf(err, "failed to retrieve key %q from brain", key)
}
if ok {
msg.Respond("%s is %s", key, value)
} else {
msg.Respond("I do not remember %q", key)
}
return nil
}
func (b *ExampleBot) ShowKeys(msg mili.Message) error {
keys, err := b.Store.Keys()
if err != nil {
return err
}
msg.Respond("I got %d keys:", len(keys))
for i, k := range keys {
msg.Respond("%d) %q", i+1, k)
}
return nil
}
If you want to hack on this repository, please read the short CONTRIBUTING.md guide first.
We use SemVer for versioning. For the versions available, see the tags on this repository.
See also the list of contributors who participated in this project.
This project is licensed under the BSD-3-Clause License - see the LICENSE file for details.
FAQs
Unknown package
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
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.