Giter Club home page Giter Club logo

from typeing import final

from telegram import update

token final= HTTP API:7172926130:AAHLdXaQBZeRVk1MzXgVUYtfs1i5HLMwojo BOT_USERNAME :final @Signengineering_bot

async def start_command ( update: update, context: contextType,DEFAULT_Type); await update, message, reply_text ( hello እሺ ስላገኘሁ/ሽ በጣም ደስ ብሎኛል እኔ sign እባላለሁ)

async def help_command ( update: update, context: contextType,DEFAULT_Type); await update, message, reply_text ( እኔ sign ነኝ እሺ😍 ማለት የሚፈልጉት ነገር ካለ ይጠይቁኝ እመልሳለሁ )

async def custom_command ( update: update, context: contextType,DEFAULT_Type); await update, message, reply_text ( This is a custom command !')

#Responses

def handel_response( text : STR ) > STR: processed: STR=text. lower ( )

 if '(ሰላም).( እንዴት ነህ).(ሀይ), (ሰላም ነው) ' in processed
 return  ሰላም አለሁ 

 
 if  ' hello. hi ,  in processed 
 return hey there
 
 if 'እንዴት ነው ሰላም ነው ' in processed
 return አለን እና ምን ዓይነት እገዛ እንዳደርግ ይፈልጋሉ 
 
 
return   🙄ምን እያሉ እንደሆነ አልገባኝም 🙄


async def handel_message(update: update, context: contextType,DEFAULT_Type);
message_type: str= update.message.chat.type
text: str= update.message.text
 
 
 print(f' user ({update.message.chat.id}) in {message_type}="{text}" ')
 
 
 
 if message_type= 'group';
 if BOT_USERNAME in text ;
   new_text; str= text.replace (BOT_USERNAME.'').strip ()
    response; str = handle_response(new_text)
 
 else;
 
 return
 
 else;
 
 response; str= handle_response(text)
 
 print ('Bot;', response)
 await update. message. reply_text(response)
 
 async  def  error ( update: update, context: contextType,DEFAULT_Type);
 print(f' update {update} caused error .{context.error}')
 
 if _name_='_main_';
 print ('starting bot....')
 app= application. builder (). token(TOKEN). build ()
 
 
 #commands
 app.add_handler (commandhandler('start'. start_command))
 app.add_handler (commandhandler('help'. help_command))
app.add_handler (commandhandler('custom'.custom_command))

#messages
app.add_handler(meassaghandler(filters.text.handle_message))

#errors
app.add_error_handler(error)

#polls the bot
print ('bolling ....')
app.run_ polling (poll_intervale=3)

gediyon0's Projects

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.