duckduckdoof / discord_dreams

Some messing around with discord bots
0 stars 0 forks source link

Feature/Rework: trade in the main FIFO Queue with one capable of pushing an item to the front #8

Open Xokuraza opened 2 years ago

Xokuraza commented 2 years ago

Perhaps we should trade in the main FIFO Queue with one capable of pushing an item to the front. This might already possible in Python Queues but idk. "I want to play a quick song real quick but Connor just queued up another Steely Dan album"

Xokuraza commented 2 years ago

copied from discord thread:

Feature/Rework: Perhaps we should trade in the main FIFO Queue with one capable

of pushing an item to the front. This might already possible in Python Queues but idk. "I want to play a quick song real quick but Connor just queued up another Steely Dan album" Luke — Yesterday at 12:23 PM I think python has a priority queue with a sort option That might be the simplest - have a default priority on insert, then have a way to insert with higher priority and trigger a sort Could be tied to a specific privelege Xokuraza — Yesterday at 12:26 PM I dont think we should try to trigger sorting, i think if we just have a FiFO queue, with an additional function to insert at the front of the queue. And it would just pop the top off normally and that function can be barred by privilages queue: [a, b, c, d, e]

insert(f);

queue: [a, b, c, d, e, f]

queue.pop()

queue: [b, c, d, e, f]

insertFront(g);

queue: [g, b, c, d, e, f]

queue.pop()

queue: [b, c, d, e, f] Luke — Yesterday at 12:29 PM Ok, the python object in that case is a deque, which supports left and right appends/pops Xokuraza — Yesterday at 12:29 PM aha perfect! i figured there must be some kind of multidirectional structure there in python Luke — Yesterday at 12:30 PM Command could be something like "m!fq" to queue to front (or something) Xokuraza — Yesterday at 12:30 PM yeah, or whatever prefix ... Xokuraza — Yesterday at 12:40 PM i have my doubts that this bot will be super widely distributed (no offense, just looking at the youtube api bot landscape) and i think the main users will be people we already know so id be happy to let anyone jump the queue if they really wana lol ¯_(ツ)_/¯