chore: unexport some bot imports
This commit is contained in:
parent
1addcc7ae3
commit
bd3d7b909a
1 changed files with 7 additions and 9 deletions
16
src/main.zig
16
src/main.zig
|
|
@ -1,12 +1,10 @@
|
|||
const std = @import("std");
|
||||
|
||||
const zigeru = @import("zigeru");
|
||||
const bot = zigeru.bot;
|
||||
const Bot = zigeru.bot.Bot;
|
||||
const Error = zigeru.bot.Error;
|
||||
const UserCommand = zigeru.commands.UserCommand;
|
||||
const AdminCommand = zigeru.commands.AdminCommand;
|
||||
const BotMessage = zigeru.bot.Message;
|
||||
const BotResponse = zigeru.bot.Response;
|
||||
const zircon = @import("zircon");
|
||||
|
||||
var debug_allocator = std.heap.DebugAllocator(.{}).init;
|
||||
|
|
@ -96,7 +94,7 @@ pub const BotAdapter = struct {
|
|||
const nick = nickFromPrefix(msg.prefix);
|
||||
|
||||
// create message
|
||||
const bot_message = BotMessage.initOwned(
|
||||
const bot_message = bot.Message.initOwned(
|
||||
self.allocator,
|
||||
std.time.timestamp(),
|
||||
nick,
|
||||
|
|
@ -124,11 +122,11 @@ pub const BotAdapter = struct {
|
|||
}
|
||||
|
||||
/// report errors as private message to admin channel.
|
||||
fn reportError(err: Error) zircon.Message {
|
||||
fn reportError(err: bot.Error) zircon.Message {
|
||||
const err_msg = switch (err) {
|
||||
Error.NoMessage => "no matching message",
|
||||
Error.OutOfMemory => "out of memory",
|
||||
Error.WriteFailed => "write failed",
|
||||
bot.Error.NoMessage => "no matching message",
|
||||
bot.Error.OutOfMemory => "out of memory",
|
||||
bot.Error.WriteFailed => "write failed",
|
||||
};
|
||||
return .{ .PRIVMSG = .{ .prefix = null, .targets = "#eru-admin", .text = err_msg } };
|
||||
}
|
||||
|
|
@ -151,7 +149,7 @@ fn nickFromPrefix(prefix: ?zircon.Prefix) []const u8 {
|
|||
}
|
||||
|
||||
/// toIRC converts a bot response and converts it to a IRC message.
|
||||
fn toIRC(response: BotResponse) zircon.Message {
|
||||
fn toIRC(response: bot.Response) zircon.Message {
|
||||
switch (response) {
|
||||
.join => |join| return .{
|
||||
.JOIN = .{ .prefix = null, .channels = join.channels },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue