Skip to content

gediyon0/gediyon0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

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)

About

Config files for my GitHub profile.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published