Skip to content

Multiple responses in a callback #1

Description

@jailbird777

I know this is a really dumb question, sorry, as I'm still learning Zig so I'm having a hard time learning from the code itself.

I'm using the sample IRC bot code, and one of the first things I wanted to do was enhance the !help text. Most output is multiline, and the code doesn't automatically handle linebreaks like \r\n in the text, so I tried doing something like:

fn help(prefix: ?zircon.Prefix, targets: []const u8) ?zircon.Message {
_ = zircon.Message{
.PRIVMSG = .{
.targets = if (prefix) |p| p.nick orelse targets else targets,
.text = "Commands are:",
},
};
return = zircon.Message{
.PRIVMSG = .{
.targets = if (prefix) |p| p.nick orelse targets else targets,
.text = "!help (This text)",
},
};
}

But sadly, only the last one ever makes it (the "!help (This text)" one). What stupid thing am I missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions