Add gitignore

main
Eragon 7 months ago
parent 8c46906cc2
commit 31e4efed44
Signed by: Eragon
GPG Key ID: 087126EBFC725006
  1. 5
      .gitignore
  2. 5
      bridge.py
  3. 15
      shoutbox.py

5
.gitignore vendored

@ -0,0 +1,5 @@
cookies.py
sasl.py
users.py
__pycache__/

@ -8,6 +8,7 @@ from irc import IRC
from shoutbox import Shoutbox
from cookies import cookies
from sasl import nick, password
from users import users
LOG_FORMAT = "%(asctime)s [%(levelname)s] <%(filename)s> %(funcName)s: %(message)s"
@ -18,9 +19,11 @@ channels = ["hs", "projets", "annonces"]
irc = IRC('irc.planet-casio.com', 6697)
shoutbox = Shoutbox(cookies)
@irc.on(lambda m: m.to[1:] in channels)
def handle_irc(m):
shoutbox.post(f"{m.author}: {m.text}", m.to[1:])
shoutbox.post(m.author, m.text, m.to[1:], users)
@shoutbox.on(lambda m: m.channel in channels and m.author != "IRC")
def handle_shoutbox(m):

@ -48,9 +48,18 @@ class Shoutbox(object):
return callback
def post(self, msg, channel):
r.post("https://www.planet-casio.com/Fr/shoutbox/api/post",
data={"message": msg, "channel": channel}, cookies=self.cookies)
def post(self, user, msg, channel, users):
if any(user in t for t in users):
for i in users:
if i[1] == user:
r.post("https://www.planet-casio.com/Fr/shoutbox/api/post-as",
data={"user": i[0], "message": msg, "channel": channel},
cookies=self.cookies)
else:
r.post("https://www.planet-casio.com/Fr/shoutbox/api/post-as",
data={"user": "IRC", "message": f"{user} : {msg}", "channel": channel},
cookies=self.cookies)
class SBMessage(object):
def __init__(self, raw, channel):

Loading…
Cancel
Save