Comments (5)
User('username').send("!command")
executes in the Bot.new block, i.e. when you load the file, not when the bot is connected. As there is no connection yet, this will fail in many ways.
from cinch.
all I put after bot.start
is not executed.
For example
require 'cinch'
bot = Cinch::Bot.new do
configure do |c|
c.server = "irc.server.org"
c.nick = "bot_name"
c.channels = ["#channel"]
end
on :message, /^regex)/ do |m,challenge|
# some stuff
m.reply "!command answer}"
end
end
bot.start
User('username').send("!command")
# all stuff here, cinch or ruby command, won't be executed
from cinch.
Because bot.start
is thread-locking (its waiting for incoming messages). I'd suggest to try Cinch plugins or create Thread
s
from cinch.
That would have been great if Cinch has this feature out of the box. I don't understand that Cinch can reply to message with on :message
but can't directly send message to a user.
Plugin doc is empty since 2012. ANd this example doesn't help me to understand how to send a message (not just replying) with a plugin.
Create a thread is more a workaround than a solution.
from cinch.
I find a way. For example waiting for a special private message or on :connect
:
on :private, /^send_target/ do
candy = Cinch::Target.new("target-user", bot)
candy.send("message")
end
This will be nice to write someting like this in the doc.
from cinch.
Related Issues (20)
- How create an event for all message sended ? HOT 1
- Can I running In Background? HOT 3
- Site is offline HOT 1
- Upon timeout (either through internet loss or server connection loss), cinch replays already-executed messages and commands. HOT 3
- "Write" and "ping" irc threads still open after bot.quit HOT 1
- Uppercase CTCP commands so they always match
- Is this still maintained? HOT 3
- Method name typo cinch v2.3.3 HOT 1
- Support for reverse DCC SEND
- Sometimes on_channel handler receives message concatenated with other one
- IRCv3 tags broken if tag value contains a colon HOT 4
- backup file in gem HOT 3
- ":invite" event is not documented HOT 2
- adding proxy support HOT 1
- Bot#oper crashes the process when used specific IRCds
- Mismatch between code and released version. HOT 1
- Missing documentation for bot configuration HOT 5
- idle method always return 0 HOT 11
- SASL authentication times out HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cinch.