-
Notifications
You must be signed in to change notification settings - Fork 0
[wip][eyes] add eyes cog #4
base: master
Are you sure you want to change the base?
Conversation
only works if loaded via repl this is where the cog started
sorry, not very github-flowy still not in working condition. lots of settings though: [p]eyes channel # log a channel [p]eyes server # act like toggling all channels [p]eyes list # list logged channels (should we have something about servers? maybe in PM) [p]eyes timezone # tries to get current tz by default, but lets you choose [p]eyes bell # settings for ANSI bell [p]eyes bell toggle # toggle whole server or individual channels (keep an eye out for this later) [p]eyes bell user # toggles watching for a username in server [p]eyes bell me # toggles watching bot owner everywhere [p]eyes bell regex # toggles specific regex. (add global regex later)
please read the recent commit description |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some comments
eyes/eyes.py
Outdated
EMPTY_REGEX_SETS = {"USERS": [], "RAW": []} | ||
|
||
|
||
class C: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really need to rewrite this enum better
|
||
|
||
class Eyes: | ||
"""👀""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I liked the minimal descriptions on this cog. are you guys opposed?
def __init__(self, bot): | ||
self.bot = bot | ||
self.settings = dataIO.load_json(SETTINGS_PATH) | ||
self.bot.loop.create_task(self.update_me_help()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kinda hacky. not sure if it works
eyes/eyes.py
Outdated
bells = self.settings['BELLS'] | ||
return self.bell_id(channel_or_server) in bells""" | ||
|
||
def bell_id(self, channel_or_server): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might trip you up. is there a cleaner simple way to do this?
eyes/eyes.py
Outdated
def save(self): | ||
return dataIO.save_json(SETTINGS_PATH, self.settings) | ||
|
||
def highlight_me(self, content, server): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to rethink the whole way we colorize things
chan_sets = self.settings['CHANNELS'] | ||
try: # lol | ||
serv_sets.remove(server.id) | ||
except ValueError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new way to toggle \o/
eyes/eyes.py
Outdated
|
||
|
||
# REGEX: | ||
# "{@100406911567949824.display_name}".format(**{'@'+m.id: m for m in server.members}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this works.
gross for large servers but I kinda want to use it cause it works and it's new.
plus, that means we can do it easily for owner and other users
server = ctx.message.server | ||
me = server.me | ||
text_channels = [c for c in server.channels | ||
if c.type is discord.ChannelType.text] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, don't check for read_permission here. should we do so when adding?
mmm naw.
but should we let the user know somehow if a channel is not readable?
|
||
msg = "I have :eyes:s in:\n" | ||
if chans > len(text_channels) / 2: | ||
msg = "I don't have :eyes:s in:\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wanted to give the user the lesser of the 2
pinned = "PINNED: " if m.pinned else "{}PINNED: ".format(C.BOLD+"UN"+C.ENDC+C.OKGREEN) | ||
|
||
c = highlight_me(C.green(pad(m.clean_content))) | ||
ms = dt.datetime.now().strftime('%H:%M%p') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use timestamp + TZ setting throughout
I feel like both names should be shown, actually. |
c = self.highlight_bells(msg) | ||
ms = dt.datetime.now().strftime('%H:%M%p') # use timestamp + TZ throughout | ||
mcl = max_channel_length(msg) | ||
ms += ' #{:<{}} @{}:{}'.format(msg.channel.name, mcl, msg.author, c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@{ir}meiguess(irdumb#1299) instead
right now only works if loaded via repl
this is where the cog started
Desc:
class C
stuff. rethink the way coloring is done