mirror of
https://github.com/iio612/DEFENDER.git
synced 2026-02-14 03:34:23 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9533b010b2 | ||
|
|
dbfc04a936 | ||
|
|
824db73590 | ||
|
|
bfb449f804 | ||
|
|
96bf4b6f80 | ||
|
|
8c772f5882 | ||
|
|
922336363e |
@@ -263,7 +263,6 @@ class Channel:
|
|||||||
@dataclass
|
@dataclass
|
||||||
class ChannelModel:
|
class ChannelModel:
|
||||||
name: str
|
name: str
|
||||||
mode: str
|
|
||||||
uids: list
|
uids: list
|
||||||
|
|
||||||
UID_CHANNEL_DB: list[ChannelModel] = []
|
UID_CHANNEL_DB: list[ChannelModel] = []
|
||||||
@@ -302,21 +301,6 @@ class Channel:
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def update(self, name: str, newMode: str) -> bool:
|
|
||||||
|
|
||||||
result = False
|
|
||||||
|
|
||||||
for record in self.UID_CHANNEL_DB:
|
|
||||||
if record.name == name:
|
|
||||||
record.mode = newMode
|
|
||||||
result = True
|
|
||||||
self.log.debug(f'Mode ({record.name}) has been updated with new mode {newMode}')
|
|
||||||
|
|
||||||
if not result:
|
|
||||||
self.log.critical(f'The channel mode {newMode} was not updated, name = {name}')
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
def delete(self, name: str) -> bool:
|
def delete(self, name: str) -> bool:
|
||||||
|
|
||||||
result = False
|
result = False
|
||||||
|
|||||||
@@ -713,11 +713,7 @@ class Irc:
|
|||||||
case 'MODE':
|
case 'MODE':
|
||||||
#['@msgid=d0ySx56Yd0nc35oHts2SkC-/J9mVUA1hfM6+Z4494xWUg;time=2024-08-09T12:45:36.651Z',
|
#['@msgid=d0ySx56Yd0nc35oHts2SkC-/J9mVUA1hfM6+Z4494xWUg;time=2024-08-09T12:45:36.651Z',
|
||||||
# ':001', 'MODE', '#a', '+nt', '1723207536']
|
# ':001', 'MODE', '#a', '+nt', '1723207536']
|
||||||
cmd.pop(0)
|
pass
|
||||||
if '#' in cmd[2]:
|
|
||||||
channel = cmd[2]
|
|
||||||
mode = cmd[3]
|
|
||||||
self.Channel.update(channel, mode)
|
|
||||||
|
|
||||||
case 'SJOIN':
|
case 'SJOIN':
|
||||||
# ['@msgid=5sTwGdj349D82L96p749SY;time=2024-08-15T09:50:23.528Z', ':001', 'SJOIN', '1721564574', '#welcome', ':001JD94QH']
|
# ['@msgid=5sTwGdj349D82L96p749SY;time=2024-08-15T09:50:23.528Z', ':001', 'SJOIN', '1721564574', '#welcome', ':001JD94QH']
|
||||||
@@ -747,7 +743,6 @@ class Irc:
|
|||||||
self.Channel.insert(
|
self.Channel.insert(
|
||||||
self.Channel.ChannelModel(
|
self.Channel.ChannelModel(
|
||||||
name=channel,
|
name=channel,
|
||||||
mode=mode,
|
|
||||||
uids=list_users
|
uids=list_users
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -756,7 +751,7 @@ class Irc:
|
|||||||
# ['@unrealircd.org/geoip=FR;unrealircd.org/userhost=50d6492c@80.214.73.44;unrealircd.org/userip=50d6492c@80.214.73.44;msgid=YSIPB9q4PcRu0EVfC9ci7y-/mZT0+Gj5FLiDSZshH5NCw;time=2024-08-15T15:35:53.772Z',
|
# ['@unrealircd.org/geoip=FR;unrealircd.org/userhost=50d6492c@80.214.73.44;unrealircd.org/userip=50d6492c@80.214.73.44;msgid=YSIPB9q4PcRu0EVfC9ci7y-/mZT0+Gj5FLiDSZshH5NCw;time=2024-08-15T15:35:53.772Z',
|
||||||
# ':001EPFBRD', 'PART', '#welcome', ':WEB', 'IRC', 'Paris']
|
# ':001EPFBRD', 'PART', '#welcome', ':WEB', 'IRC', 'Paris']
|
||||||
uid = str(cmd[1]).replace(':','')
|
uid = str(cmd[1]).replace(':','')
|
||||||
channel = str(cmd[3])
|
channel = str(cmd[3]).lower()
|
||||||
self.Channel.delete_user_from_channel(channel, uid)
|
self.Channel.delete_user_from_channel(channel, uid)
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -220,6 +220,7 @@ class Votekick():
|
|||||||
if chan.vote_for > chan.vote_against:
|
if chan.vote_for > chan.vote_against:
|
||||||
self.Irc.send2socket(f':{dnickname} PRIVMSG {channel} :The user {self.Config.CONFIG_COLOR["gras"]}{target_user}{self.Config.CONFIG_COLOR["nogc"]} will be kicked from this channel')
|
self.Irc.send2socket(f':{dnickname} PRIVMSG {channel} :The user {self.Config.CONFIG_COLOR["gras"]}{target_user}{self.Config.CONFIG_COLOR["nogc"]} will be kicked from this channel')
|
||||||
self.Irc.send2socket(f":{dnickname} KICK {channel} {target_user} Following the vote, you are not welcome in {channel}")
|
self.Irc.send2socket(f":{dnickname} KICK {channel} {target_user} Following the vote, you are not welcome in {channel}")
|
||||||
|
self.Channel.delete_user_from_channel(channel, self.User.get_uid(target_user))
|
||||||
elif chan.vote_for <= chan.vote_against:
|
elif chan.vote_for <= chan.vote_against:
|
||||||
self.Irc.send2socket(f':{dnickname} PRIVMSG {channel} :This user will stay on this channel')
|
self.Irc.send2socket(f':{dnickname} PRIVMSG {channel} :This user will stay on this channel')
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"version": "5.0.1"
|
"version": "5.0.4"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user