Add custom emoji mapping system for premium emoji support
Some checks failed
continuous-integration/drone/pr Build is failing
Some checks failed
continuous-integration/drone/pr Build is failing
- Create emoji_mappings table to store emoji->emoji_id mappings - Add EmojiMappingService for managing emoji registration and replacement - Add admin emoji handlers (/add_emoji, /my_emojis, /delete_emoji, /all_emojis) - Create emoji message helper for automatic emoji processing - Add Alembic migration for emoji_mappings table - Integrate emoji router into main dispatcher - Add comprehensive documentation (EMOJI_SYSTEM.md) - Fix migration chain issue with merge_migration Features: - Admins can register premium emojis via /add_emoji command - Automatic emoji->emoji_id replacement before sending messages - Per-admin unique constraint on emoji registration - Track last used timestamp for analytics - Bulk operations support
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"""merge branches
|
||||
|
||||
Revision ID: merge_migration
|
||||
Revises: 41aae82e631b, cd31303a681c
|
||||
Revises: cd31303a681c
|
||||
Create Date: 2026-02-18 04:02:12.000000
|
||||
|
||||
"""
|
||||
@@ -11,7 +11,7 @@ import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'merge_migration'
|
||||
down_revision = ('41aae82e631b', 'cd31303a681c')
|
||||
down_revision = 'cd31303a681c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
45
migrations/versions/20260307_0100_add_emoji_mappings.py
Normal file
45
migrations/versions/20260307_0100_add_emoji_mappings.py
Normal file
@@ -0,0 +1,45 @@
|
||||
"""Add emoji_mappings table for storing custom emoji IDs
|
||||
|
||||
Revision ID: 20260307_0100_add_emoji_mappings
|
||||
Revises: merge_migration
|
||||
Create Date: 2026-03-07 01:00:00.000000
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '20260307_0100_add_emoji_mappings'
|
||||
down_revision = 'merge_migration'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table(
|
||||
'emoji_mappings',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('emoji_text', sa.String(length=10), nullable=False),
|
||||
sa.Column('emoji_id', sa.String(length=255), nullable=False),
|
||||
sa.Column('admin_id', sa.Integer(), nullable=False),
|
||||
sa.Column('description', sa.String(length=255), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('last_used_at', sa.DateTime(timezone=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(['admin_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('emoji_id', name='emoji_mappings_emoji_id_key'),
|
||||
sa.UniqueConstraint('emoji_text', 'admin_id', name='unique_emoji_per_admin'),
|
||||
)
|
||||
op.create_index('ix_emoji_mappings_emoji_id', 'emoji_mappings', ['emoji_id'], unique=True)
|
||||
op.create_index('ix_emoji_mappings_emoji_text', 'emoji_mappings', ['emoji_text'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index('ix_emoji_mappings_emoji_text', table_name='emoji_mappings')
|
||||
op.drop_index('ix_emoji_mappings_emoji_id', table_name='emoji_mappings')
|
||||
op.drop_table('emoji_mappings')
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user