File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ module.exports = new Command({
4242 . setColor ( 0xA47DAB )
4343 . setDescription (
4444 queue . map ( ( q , i ) =>
45- `#${ i + 1 } (ID ${ q . id } ) - ${ q . question } ` )
45+ `#${ i + 1 } - ${ q . question } ` )
4646 . join ( '\n' ) || 'Queue is empty.' ) ;
4747 message . channel . send ( { embeds : [ queueEmbed ] } ) ;
4848 break ;
Original file line number Diff line number Diff line change @@ -54,7 +54,20 @@ module.exports = {
5454 getPast : ( ) => all (
5555 'SELECT * FROM past_questions ORDER BY posted_at DESC LIMIT 10' ) ,
5656
57- removeQuestion : ( id ) => run ( 'DELETE FROM queue WHERE id = ?' , [ id ] ) ,
57+ removeQuestion : async ( position ) => {
58+ const index = parseInt ( position ) - 1 ;
59+ if ( isNaN ( index ) || index < 0 ) throw new Error ( 'Invalid position' ) ;
60+
61+ const target = await get (
62+ 'SELECT id FROM queue ORDER BY priority DESC, id ASC LIMIT 1 OFFSET ?' ,
63+ [ index ]
64+ ) ;
65+
66+ if ( target ) {
67+ return run ( 'DELETE FROM queue WHERE id = ?' , [ target . id ] ) ;
68+ }
69+ return null ;
70+ } ,
5871
5972 popNext : async ( ) => {
6073 const next = await get (
You can’t perform that action at this time.
0 commit comments