This commit is contained in:
raylu 2010-11-03 21:15:27 -04:00
parent 3fa45f510a
commit 7734a9ad4a
3 changed files with 15 additions and 2 deletions

View File

@ -68,18 +68,19 @@ Op commands:
- `topic text`: sets the topic and basetopic to text - `topic text`: sets the topic and basetopic to text
- `topic`: gets the current basetopic - `topic`: gets the current basetopic
- `appendtopic text`: if the topic does not starts with basetopic, sets the basetopic to the current topic. Makes the topic basetopic+text. - `appendtopic text`: if the topic does not starts with basetopic, sets the basetopic to the current topic. Makes the topic basetopic+text.
- `part`: leaves the channel
Google API commands: Google API commands:
- `tr text`: detect the language of text - `tr text`: detect the language of text
- `tr en|ja en|es text`: translate text into Japanese and Spanish - `tr en|ja en|es text`: translate text into Japanese and Spanish
- `calc 2-1 usd in yen`: convert 1 USD to Japanese yen - `calc 1 usd in yen`: convert 1 USD to Japanese yen
Commands that don't require access behave the same when sent to a channel the bot is in and when whispered to the bot. Commands that don't require access behave the same when sent to a channel the bot is in and when whispered to the bot.
Commands that require access are listed above as if they were sent to a channel. When sent as a whisper, the first argument must be a channel name. Commands that require access are listed above as if they were sent to a channel. When sent as a whisper, the first argument must be a channel name.
The bot will accept invites from the owner to any channel. The bot will accept invites from the owner to any channel and only the owner can use `part`.
### Miscellaneous ### Miscellaneous

View File

@ -241,3 +241,14 @@ func appendtopic(conn *irc.Conn, nick *irc.Nick, args, target string) {
} }
conn.Topic(channel, basetopic + args) conn.Topic(channel, basetopic + args)
} }
func part(conn *irc.Conn, nick *irc.Nick, args, target string) {
channel, args := parseChannel(target, args)
if channel == "" {
return
}
user := user(nick)
if owner, _ := auth.String(conn.Network, "owner"); owner == user {
conn.Part(channel, "")
}
}

View File

@ -35,6 +35,7 @@ var commands = map [string]func(*irc.Conn, *irc.Nick, string, string) {
"kb": kickban, "kb": kickban,
"topic": topic, "topic": topic,
"appendtopic": appendtopic, "appendtopic": appendtopic,
"part": part,
// google // google
"tr": translate, "tr": translate,