Skip to content
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

Error when send notification #1929

Closed
SaidtheBoss opened this issue Apr 30, 2020 · 6 comments
Closed

Error when send notification #1929

SaidtheBoss opened this issue Apr 30, 2020 · 6 comments
Labels

Comments

@SaidtheBoss
Copy link

SaidtheBoss commented Apr 30, 2020

Issue I am facing

When there are small amount of users i have no problem but when the amount gets larger like 50+ then i cant send notification

Traceback to the issue

my code takes the user id and puts it on a set
put it here

def start(update, context,d = True):
    user_id = update.message.from_user.id
    print(user_id)
    global id_number
    id_number.add(str(user_id))

and when i send command /Notif

def notifsender(update,context):
    print("notification")
    global datanotif
    datanotif = pd.read_csv("notif.csv")
    global id_number
    Link = datanotif['pic'].values
    Link = str(Link[0])
    text = datanotif['text'].values
    text = str(text[0])
    for i in list(id_number):
        bot.send_photo(chat_id=i, photo=Link)
        context.bot.send_message(chat_id=i, text=text)

(my code takes notification and pic from file)
When there are like 10 users i can send notification to all the users but when i have 25 users its not sending notifications even to me

@Bibo-Joshi
Copy link
Member

Well, without actual error traceback, I can only guess, but the guess would be that you're hidding flood limits. We have a wiki page for that.

Also, you may want to use bot_data (here) instead of global variables.

@SaidtheBoss
Copy link
Author

Well, without actual error traceback, I can only guess, but the guess would be that you're hidding flood limits. We have a wiki page for that.

Also, you may want to use bot_data (here) instead of global variables.

so is there a proper way i can send notifications to all my users?

@SaidtheBoss
Copy link
Author

And is there away i can delay messages?

@SaidtheBoss
Copy link
Author

SaidtheBoss commented Apr 30, 2020

def notifsender(update,context):
    print("notification")
    global datanotif
    datanotif = pd.read_csv("notif.csv")
    global id_number
    Link = datanotif['pic'].values
    Link = str(Link[0])
    text = datanotif['text'].values
    text = str(text[0])
    for i in list(id_number):
        bot.send_photo(chat_id=i, photo=Link)
        context.bot.send_message(chat_id=i, text=text)

how can i edit this code so it would avoid Floodgate limit?

@SaidtheBoss
Copy link
Author

thanks in advance :)

@Bibo-Joshi
Copy link
Member

As for flood limits: See my previous comment.
Sending to all users: See #1836. As this is in fact pretty much a duplicate of that, I'll be closing this one.

Also, please don't comment like you're on an instant messenger. It clutters the thread and there are people, who receive an E-Mail every time you comment.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants