This repository has been archived by the owner on Jan 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f02355
commit 0afb568
Showing
6 changed files
with
159 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[INFO] | ||
|
||
server_url = chat.freenode.net | ||
port = 6667 | ||
name = appinventormuBot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ joke | |
maths | ||
calc | ||
conv_sniff | ||
caesar_cipher | ||
caesar_cipher | ||
debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from main import Bot_core as Bot | ||
|
||
bot = Bot() | ||
print(bot.specific_send_command('#abc', 'greetings')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
[debug.py] | ||
Debug plugin : Un | ||
[Author] | ||
Abdur-Rahmaan Janhangeer, pythonmembers.club | ||
[About] | ||
prints all parameters passed to bot | ||
[Commands] | ||
>>> .debug | ||
prints all parameters | ||
""" | ||
|
||
|
||
class Plugin: | ||
def __init__(self): | ||
pass | ||
|
||
def run(self, incoming, methods, info): | ||
try: | ||
# if '!~' in info['prefix']: | ||
# print(info) | ||
if info['command'] == 'PRIVMSG' and info['args'][1] == '.debug': | ||
methods['send'](info['address'], info['prefix']) | ||
except Exception as e: | ||
print('woops plug', e) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import unittest | ||
import configparser | ||
from main import Bot_core as Bot | ||
''' | ||
':appinv!c5e342c5@gateway/web/cgi-irc/kiwiirc.com/ip.197.227.66.197 PRIVMSG ##bottestingmu :ef' | ||
{ | ||
'prefix': 'appinv!c5e342c5@gateway/web/cgi-irc/kiwiirc.com/ip.197.227.66.197', | ||
'command': 'PRIVMSG', | ||
'address': '##bottestingmu', | ||
'args': ['##bottestingmu', 'ef'] | ||
} | ||
''' | ||
config = configparser.ConfigParser() | ||
config.read('CONNECT.conf') | ||
|
||
# incoming | ||
incoming = ':appinv!c5e342c5@gateway/web/cgi-irc/kiwiirc.com/ip.200.200.22.200 PRIVMSG ##bottestingmu :ef' | ||
bot = Bot() | ||
|
||
|
||
class HoneybotTests(unittest.TestCase): | ||
''' | ||
basic info | ||
''' | ||
def test_name(self): | ||
self.assertEqual( | ||
bot.name, | ||
config['INFO']['name']) | ||
|
||
def test_server_url(self): | ||
self.assertEqual( | ||
bot.server_url, | ||
config['INFO']['server_url']) | ||
|
||
def test_port(self): | ||
self.assertEqual( | ||
bot.port, | ||
int(config['INFO']['port'])) | ||
''' | ||
info function | ||
''' | ||
def test_info_prefix(self): | ||
self.assertEqual( | ||
bot.info(incoming)['prefix'], | ||
'appinv!c5e342c5@gateway/web/cgi-irc/kiwiirc.com/ip.200.200.22.200') | ||
|
||
def test_info_command(self): | ||
self.assertEqual( | ||
bot.info(incoming)['command'], | ||
'PRIVMSG') | ||
|
||
def test_info_address(self): | ||
self.assertEqual( | ||
bot.info(incoming)['address'], | ||
'##bottestingmu') | ||
|
||
def test_info_args(self): | ||
self.assertEqual( | ||
bot.info(incoming)['args'], | ||
['##bottestingmu', 'ef']) | ||
|
||
''' | ||
commands | ||
''' | ||
def test_set_nick_command(self): | ||
self.assertEqual( | ||
bot.set_nick_command(), | ||
'NICK {0}\r\n'.format(config['INFO']['name']) | ||
) | ||
|
||
def test_present_command(self): | ||
self.assertEqual( | ||
bot.present_command(), | ||
'USER {0} {0} {0} : {0} IRC\r\n'.format(config['INFO']['name']) | ||
) | ||
|
||
def test_identify_command(self): | ||
self.assertEqual( | ||
bot.identify_command(), | ||
'msg NickServ identify \r\n' | ||
) | ||
|
||
def test_join_command(self): | ||
self.assertEqual( | ||
bot.join_channel_command('#abc'), | ||
'JOIN #abc \r\n' | ||
) | ||
|
||
def test_specific_send_command(self): | ||
self.assertEqual( | ||
bot.specific_send_command('#abc', 'greetings'), | ||
'PRIVMSG #abc :greetings\r\n' | ||
) | ||
|
||
def test_pong_return(self): | ||
self.assertEqual( | ||
bot.pong_return(), | ||
'PONG \r\n' | ||
) | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |