- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 9
          Add check_rerun_command util to commands.py
          #137
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            TizzySaurus
  wants to merge
  8
  commits into
  main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
check-rerun-job-util
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    | ❌ Deploy Preview for bot-core failed.
 | 
…heck_rerun_command` to better reflect purpose. - The util now automatically re-invokes the command when applicable, and sends an error message otherwise. Rest of core functionality remains the same.
check_rerun_job util to commands.pycheck_rerun_command util to commands.py
      
      
        
      
      
  
    2 tasks
  
| ✅ Deploy Preview for bot-core ready!
 To edit notification comments on pull requests, go to your Netlify site settings. | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      Labels
      
    a: code
  Pull requests which add features, fixes, or any code change 
  
    a: other
  Pull requests which do not fit into any of the other categories 
  
    s: approved
  An issue or PR with core developer approval 
  
    t: feature
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Rewrites the logic of the eval command in python-discord/bot to create a re-run util (the eval command implementation had flaws, e.g including the python version to run in the edited message caused it to break since the version would be treated as code, and not the python version argument).
The core idea:
check_rerun_commandutil.REDO_TIMEOUTseconds, and the user then reacts with the 🔁 emoji that appears within 10 seconds, then the util will rerun the command (NB: this means commands with usage statistics will have the rerun add to the statistic, which doesn't currently happen but we arguably want this anyway).This is made since python-discord/sir-lancebot#1062 asks for re-run, and as such I got approval from @mbaruh in the staff-lounge to move (and as it turns out, fix) the code from bot.
I have thoroughly tested this but there's of course still a chance I missed something. Example usage of the util to aid with testing: