work in progress

This commit is contained in:
.[d]. 2022-08-08 06:41:25 -05:00
parent 22d04fbe22
commit 2778749f03
4 changed files with 79 additions and 88 deletions

27
Pipfile Normal file
View File

@ -0,0 +1,27 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
irc3 = "*"
aiocron = "*"
timeago = "*"
isodate = "*"
google-api-python-client = "*"
oauth2client = "*"
aiohttp = "*"
asyncio = "*"
async-timeout = "*"
lxml = "*"
python-twitter = "*"
googlesearch-python = "*"
pyfiglet = "*"
openai = "*"
simplematrixbotlib = "*"
ipdb = "*"
[dev-packages]
[requires]
python_version = "3.9"

View File

@ -1,10 +1,19 @@
# MAPLE+G1MP ML/Irc3 Hybrid VARIANTED INTO NETSPANNING
# MAPLE+G1MP ML/Irc3 Hybrid - Netspanning Variant
```
To summarize this, this proect is the `m4pl1mp` hybrid, where
that hybrid only uses the irc protocol for communication with
irc servers, this one also uses the matrix protocol and talks
to matrix servers. so it's essentialy two clients wrapped in
one and not only bridging information between the two networks
but unifying maple's services between them as well.
[ Netspanning ]
- irc
- matrix
[ The hybridization ]
[ The actual base hybrid ]
- m4plmp - [sourcecode](https://git.tcp.direct/decoded/m4pl1mp)
[ Hybrid of machine learning and irc3 framework ]
- Maple - [sourcecode](https://git.tcp.direct/decoded/Maple)
- g1mp - [sourcecode](https://git.tcp.direct/decoded/g1mp)
@ -13,40 +22,41 @@
1. `apt install python3`
2. `apt install python3-pip`
3. `python3 -m pip install virtualenv`
3. `python3 -m pip install --user pipenv`
## Instructions
1. `git clone --recursive https://git.tcp.direct/decoded/maple_netspan.git`
2. `cd maple_netspan`
3. `virtualenv env -p python3`
4. `source env/bin/activate`
### Append your developer api keys to env/bin/activate. Example below:
3. `sh setup.sh`
### Append your developer api keys and credentials to .venv/bin/activate. Example below:
```
cat env/bin/activate
https://console.cloud.google.com/apis/credentials
```
```
cat .venv/bin/activate
..
export BOT_SASL_USERNAME=your_nickserv_username
export BOT_SASL_PASSWORD=your_nickserv_password
export NICKSERV_USERNAME=your_nickserv_username
export NICKSERV_PASSWORD=your_nickserv_password
export MATRIX_HOMESERVER=https://matrix.org
export MATRIX___USERNAME=your_matrix_username
export MATRIX___PASSWORD=your_matrix_password
export DEVELOPER_KEY="1394823190182390182382383215382158321" # <- YOUTUBE API KEY
export CONSUMER_KEY="2151235132512351235123512351325231" # <- TWITTER API KEY
export CONSUMER_SECRET="514512521345234523452345234523452345234523452" # <- TWITTER API KEY
export ACCESS_TOKEN_KEY="24513429875209348502934850294898348034850293485203948592" # <- TWITTER API KEY
export ACCESS_TOKEN_SECRET="523490582034985203948520394804884820934850923485" # <- TWITTER API KEY
export NICKSERV_USERNAME=your_nickserv_username # <- IRCD NICKSERV USER
export NICKSERV_PASSWORD=your_nickserv_password # <- IRCD NICKSERV PASS
export BOT_SASL_USERNAME=$NICKSERV_USERNAME # <- IRCD NICKSERV USER
export BOT_SASL_PASSWORD=$NICKSERV_PASSWORD # <- IRCD NICKSERV PASS
export MATRIX_HOMESERVER=https://matrix.org # <- MATRIX HOMESERVER
export MATRIX___USERNAME=your_matrix_username # <- MATRIX USERNAME
export MATRIX___PASSWORD=your_matrix_password # <- MATRIX PASSWORD
export DEVELOPER_KEY=1394823190182390182382383215382158321 # <- YOUTUBE API KEY
export CONSUMER_KEY=2151235132512351235123512351325231 # <- TWITTER API KEY
export CONSUMER_SECRET=514512521345234523452345234523452345234523452 # <- TWITTER API KEY
export ACCESS_TOKEN_KEY=24513429875209348502934850294898348034850293485203948592 # <- TWITTER API KEY
export ACCESS_TOKEN_SECRET=523490582034985203948520394804884820934850923485 # <- TWITTER API KEY
```
5. `pip install -r requirements.txt`
6. `edit maple.py - add your matrix username here so that it self-ignores`
4. `edit maple.py - change these to your matrix bot's @username:server so that it self-ignores`
```
guds.add_credentials("@maple.or.g1mp:matrix.org")
guds.add_credentials("@maple:pcriot.org")
```
7. `edit plugins/net_matrix_plugin.py - change this username to your to access commands`
5. `edit plugins/net_matrix_plugin.py - changing to your username gives you access to matrix commands`
```
if m_sender=="@d:tcp.direct":
m_sender=="@d:tcp.direct"
```
8. `python3 maple.py`
6. `pipenv run maple.py`

View File

@ -1,63 +0,0 @@
# -*- coding: utf-8 -*- ############################################################### SOF
import irc3,os,threading,asyncio,ipdb
from time import sleep
from plugins.tool_dims_plugin import dims
from plugins.tool_guds_plugin import guds
from plugins.net_irc_plugin import config_ircbot
from plugins.net_irc_plugin import start_ircbot
from plugins.net_matrix_plugin import start_matrixbot
from plugins.tool_bus_plugin import BUS
##################################################channel##################################
class BOTIO:
#######################################################################################
verbosity=True
log_exit_level=[]
#######################################################################################
def __init__(self):
print(f'<<< ________botio_class >>> [ instantiated ]')
self.ircbot=config_ircbot()
self.net_irc=[]
self.net_matrix=[]
print(f'<<< ________botio_class >>> [ ircbot configured ]')
#######################################################################################
def __boot__irc(self):
print('<<< system_status__info >>> [ booting connection: irc ]')
self=start_ircbot(self)
#######################################################################################
def __boot__matrix(self):
print('<<< system_status__info >>> [ booting connection: matrix ]')
self=start_matrixbot(self)
#######################################################################################
def __boot__empty(self):
print('<<< system_status__info >>> [ booting connection: empty ]')
#######################################################################################
def __main__(self,index):
if index==0:
t=threading.Thread(target=self.__boot__irc)
print(f'<<< system_status__info >>> [ irc thread setup ]')
t.start()
print(f'<<< system_status__info >>> [ irc thread started ]')
elif index==1:
t=threading.Thread(target=self.__boot__matrix)
print(f'<<< system_status__info >>> [ matrix thread setup ]')
t.start()
t.join()
print(f'<<< system_status__info >>> [ matrix thread started ]')
# elif index==2:
# print(f'<<< system_status__info >>> [ empty thread setup ]')
# t=threading.Thread(target=self.__boot__empty)
# t.start()
# print(f'<<< system_status__info >>> [ empty thread started ]')
###########################################################################################
if __name__ == '__main__':
print('<<< system_status__info >>> [ main startup ]')
guds.add_credentials("@maple.or.g1mp:matrix.org")
guds.add_credentials("@maple:pcriot.org")
bio=BOTIO()
globals()['guds'].memories.append([bio,'maple:__main__.bio'])
for i in range(3):
bio.log_exit_level.append(bio.__main__(i))
while True:
if bio.verbosity: print('<<< system_status__info >>> [ eventloop idler thread ]')
sleep(1)
####################################################################################### EOF

17
setup.sh Normal file
View File

@ -0,0 +1,17 @@
mkdir .venv
pipenv --python 3.9
pipenv install
echo "export BOT_SASL_USERNAME=your_nickserv_username" >> .venv/bin/activate
echo "export BOT_SASL_PASSWORD=your_nickserv_password" >> .venv/bin/activate
echo "export NICKSERV_USERNAME=your_nickserv_username" >> .venv/bin/activate
echo "export NICKSERV_PASSWORD=your_nickserv_password" >> .venv/bin/activate
echo "export MATRIX_HOMESERVER=https://matrix.org" >> .venv/bin/activate
echo "export MATRIX___USERNAME=your_matrix_username" >> .venv/bin/activate
echo "export MATRIX___PASSWORD=your_matrix_password" >> .venv/bin/activate
echo "export DEVELOPER_KEY=1394823190182390182382383215382158321" >> .venv/bin/activate
echo "export CONSUMER_KEY=2151235132512351235123512351325231" >> .venv/bin/activate
echo "export CONSUMER_SECRET=514512521345234523452345234523452345234523452" >> .venv/bin/activate
echo "export ACCESS_TOKEN_KEY=24513429875209348502934850294898348034850293485203948592" >> .venv/bin/activate
echo "export ACCESS_TOKEN_SECRET=523490582034985203948520394804884820934850923485" >> .venv/bin/activate
echo "export PYTHONASYNCIODEBUG=1" >> .venv/bin/activate
pipenv run bot_maple.py