emotebot / emotecollector Goto Github PK
View Code? Open in Web Editor NEWCollects emotes from other servers for use by people who don't have Nitro
Home Page: https://ec.emote.bot
License: GNU Affero General Public License v3.0
Collects emotes from other servers for use by people who don't have Nitro
Home Page: https://ec.emote.bot
License: GNU Affero General Public License v3.0
The dict containing which reply messages correspond to which user messages should persist across restarts. We can use Redis to do this.
probably the on_raw_message* events is the only passable part of the code, but it still needs comments
requires #5
[9:19 PM] Vex: I'd check through client.state._messages first personally
[9:19 PM] Vex: except in very rare cases it should be as up to date as fresh-getting
[9:28 PM] Cute: Check cache -> get_message -> format content -> send
May want to also try channel.history
but that's p expensive. It shouldn't be necessary unless someone wants to react to an old message.
Links surrounded in <> do not show an embed, which can be useful if the image embed is pretty big.
This should be easy to implement: if < and > are found in a message, and it's not an emote (which always have <>), just remove them.
we have a CASCADE set up on emotes so the deletion will propagate to the emotes table
May require some sort of parser or something.
Usage:
ec/quote foo :notlikeblob: bar baz
→ foo :notlikeblob: bar baz
Create a new cog in ec-website which extends the current API cog, and move the functions which are only needed to run the API, such as validate_token, to the ec-website subclass cog.
May require forking the cog and adding 3.5 support. Otherwise I'll have to figure out 3.6 on the pi.
Model it after jishaku's ReplResponseReactor.
Prevents the typing notification persisting after the emote is created.
It should:
:name:
or name
to an instanceget
returns, but as attributesspecify a Message (use emote_collector.utils.converter
) and it yanks all the emotes out
perhaps if there's more than one, ask which ones wanna be added
All that's needed is a count
column on the emojis table, and then various aggregate stats can be collected either in ec/info (no args), ec/stats (would have to change the name of the "send bot list stats" command first) or ec/about (probably not).
The aggregate statistics would be:
For #34
Basic testing seems to indicate that emote_collector.utils.resize_until_small (see below) may be causing a memory leak.
Command:
ec/add ttl <https://cdn.discordapp.com/attachments/381963689470984203/509133128418328576/terry_the_legend.gif>
Memory usage before: 39.2 MB
Memory usage after: 699.5 MB
objgraph.show_growth()
seems to indicate that multiple BytesIO objects stick around after the image resize is complete.
Two things to notice here:
The while loop essentially boils down to this each iteration:
if some_blob is too_big:
some_blob = frobnicate(some_blob)
Notice that the old some_blob
is still in memory while frobnicate
is running. After using the context manager, it may be worth assigning to separate variables and using del
manually.
Another tool I was made aware of is the ImageMagick environment variables. These can be used to limit ImageMagick's memory usage before it writes to disk instead, and can be done by resolution or image size. Very cool. If I use these env vars, make sure to include them in a fix for #44.
ec/alias alias-name target, or
ec/ln target alias-name, for those Unix users :)
Two ways to do this, schema wise:
Approach 1: Add a new table for aliases. Columns: name, id (foreign key on emotes.id).
Upon lookup of a name, either
A) first look in emotes, then in aliases, or
B) duplicate information in both tables, as RoboDanny does with tags, in order to make lookup faster
Approach 2:
Store primary emotes and aliases in the same table. Remove the unique constraint on emote IDs, and maybe use a SERIAL type as a primary key instead of ID. Add a boolean flag to indicate if the emote is an alias or the primary.
In both cases, upon deletion of an emote, delete all corresponding aliases. This would be easiest with Approach 1 (ON DELETE CASCADE).
Note: sending an emote with a different name than its name in Discord is actually not a problem:
.
It'd be cool if people could describe the meaning or purpose of their emotes. It would work like this:
ec/description speedtest Used like "this sucks" or "well, fuck". Originally from http://i0.kym-cdn.com/photos/images/original/001/285/389/9ab.jpg.
Obviously the description would have to be one of those fancy "consume rest" parameters.
Then people could view the description on ec/info speedtest
, when that's implemented (#2).
It doesn't need to report individual usages, just summaries by day. Requires #3.
Steps to reproduce
dd if=/dev/zero of=1-GiB.bin bs=(math 1024^3) count=1 iflag=fullblock
localhost:80 $ngrok_hostname:80
mime .bin image/gif
ec/add StressTest $ngrok_hostname/1-GiB.bin
extensions/db is riddled with race conditions
Copies an emote from e0 into EC. I have an archived list of emotes from E0 saved as JSON and HTML (only the HTML page has author IDs).
Opt in mode per server:
Maybe not too useful of a feature.
Allow server admins to configure a role which prevents or allows people to use the emote commands.
command name: ec/adopt?
would just create a guild emoji on the server it's in, and use the name and image from the database
Reduces API calls, and allows for prettier error messages.
end-human meat popsicle doesn't need the bot if that emote already exists on that message.
scold them if they try
On attempting to save an emote with invalid chars:
unicode
column for emotes.Display the display name in ec/info et al.
Do it ptpb.pw-style:
ec/delete-with-key <name> <key>
to delete their emotemay help people set up their own instance
Shows the name, owner, usage, and creation date of a specific emote.
E0 has a "state" command which toggles the bot responding to :name:
on that server.
It accepts a boolean argument, but it'd be easier if the bot just toggled the state.
This should be stored in the blacklists table, with a new column called "guild".
The logic would work like this:
This should probably be a commands.check
.
The reply message would contain a link to each generated emote and a reaction button to add all of them to the database
Restricted to mods only. Required for force removal.
It's causing too much pain.
Would fix #27
Unfortunately, the nature of the bot requires several backend servers that are owned by a specific person, and no other guilds that are owned by the bot owner. This means that in order to test the bot without affecting prod, I need a separate set of backend guilds, which requires another account.
I tried to create a new account but it got "verify locked" again, requiring yet another phone number to be put in. Hopefully [email protected] will help me here.
This isn't really a code issue, although https://github.com/bmintz/emoji-connoisseur/blob/4846a970d8f4d382f3a18b7a0e854d84fcb5156f/utils.py#L14 will have to be changed to pull from data/config.json afterwards.
the ToS police are out to get me, man! and they think i'm still running backend_creator.py lol.
To qualm their fears, let's rewrite this with a new technique:
instead of enumerating backend guilds entirely from cache:
requires update to everything that uses the backend guilds.
A lot of phone keyboards capitalize the first word of every sentence.
Fortunately, we don't have to add custom prefixes. Newest discord.py rewrite saves the day!
this would obviate ec/steal-these
DB column should store who marked it as NSFW, so that a user can toggle their own emotes, unless the NSFW status was set by an admin.
Would prevent people within that server from using that emote unless they had Manage Messages (Manage Emojis?) permissions. Would also send a report to a private logs channel.
should be logged either to Logs/#emotes or #report-emotes
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.