Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
relearn
2014
Commits
3fb75e1a
Commit
3fb75e1a
authored
Jul 11, 2014
by
cath
Browse files
the spanish mispelling bot
parent
45ac2aa5
Changes
1
Hide whitespace changes
Inline
Side-by-side
botnet/bots/spanishbot.py
0 → 100644
View file @
3fb75e1a
import
irc.bot
class
HelloBot
(
irc
.
bot
.
SingleServerIRCBot
):
def
__init__
(
self
,
channel
,
nickname
,
server
,
port
=
6667
):
irc
.
bot
.
SingleServerIRCBot
.
__init__
(
self
,
[(
server
,
port
)],
nickname
,
nickname
)
self
.
channel
=
channel
def
on_welcome
(
self
,
c
,
e
):
print
"Bot connected"
c
.
join
(
self
.
channel
)
def
on_privmsg
(
self
,
c
,
e
):
self
.
on_pubmsg
(
c
,
e
)
def
on_pubmsg
(
self
,
c
,
e
):
# print e.target, e.source, e.arguments, e.type
m
=
e
.
arguments
[
0
].
lower
()
b
=
m
.
replace
(
'v'
,
'b'
)
c
.
privmsg
(
self
.
channel
,
b
)
if
__name__
==
"__main__"
:
import
argparse
parser
=
argparse
.
ArgumentParser
(
description
=
'BashBot'
)
parser
.
add_argument
(
'--host'
,
default
=
"localhost"
,
help
=
'host'
)
parser
.
add_argument
(
'--port'
,
type
=
int
,
default
=
6667
,
help
=
'port'
)
parser
.
add_argument
(
'channel'
,
help
=
'channel to join'
)
parser
.
add_argument
(
'nickname'
,
help
=
'bot nickname'
)
args
=
parser
.
parse_args
()
if
not
args
.
channel
.
startswith
(
"#"
):
args
.
channel
=
"#"
+
args
.
channel
bot
=
HelloBot
(
args
.
channel
,
args
.
nickname
,
args
.
host
,
args
.
port
)
bot
.
start
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment