I've been hosting a discord bot on an online IDE but it happens to disconnect from the API after a while. The code on the IDE continues to run, but on discord, it is unable to respond to commands and essentially the entire bot is completely offline, while a running code is being executed. Even more suprising is a background task that I have assigned to run every minute continues to do it's job ( which is to edit a embed in a server with new information ). I've been going through the documentation and about the gateway kinda stuff but I'm utterly confused. It states that disconnections are regular but never teaches me how to actually connect again rather some snippets of JSON data. Documentation here : https://discord.com/developers/docs/topics/gateway#gateway-intents
I'm a bit new to this stuff but the documentation clearly doesn't talk anything about the way to connect to the gateway, and what to do during a op7 reconnect. How would I be able to incorperate this reconnection thing with my discord bot also?
I am trying to make a bot that sends out updates for a game to interested servers. These updates would be manually sent out by me through terminal (or something else). Users would invite the bot and select what channel they want updates to be sent out to (if it would be easier to make every server use the same channel I would be good with that). Hopefully this is something simple enough to make.
EDIT 1:
I have searched a little and could not find much. However I am now more clear knowing what it should do. Instead of terminal it will grab stuff from a rss feed and to avoid using a database the channels names in all the severs will be the same. No commands will be needed.
I’ve been working on a telegram bot and I just managed to design it to handle commands and issue responses to users.
I was able to achieve this successfully and started testing each and every command repeatedly to ensure they work, mind you these are like 6 or 7 commands. Basically user sends the /command and my bot sends feedback and that for like the very first few tries, like it really worked then suddenly it all stopped working.
The welcome message for new group users from the bot the feature still works but the commands aren’t.
I didn’t register all commands with BotFather but they worked anyway regardless so I’m not sure that’s the problem.
I wrote a program in Python using the quickfix package which connects to a vendor via FIX. We login in the morning, but don't actually send messages through the connection until the end of the day. The issue is, we don't want to keep the program open for the entirety of the day, but would rather relogin in the afternoon when we need to send the messages.
The vendor is requesting we stay logged in for the full duration between our start and stop times specified in our configurations. This is only possible by leaving my program on for the entirety of the day, because if I close it then the messages the vendor sends aren't registered as received by me. I don't send a logout message though.
Is it common practice to write a program to connect via FIX and leave it running for the entire session time? Or is it acceptable to close the program, given I don't send a logout message, and reconnect at a later time in the day?
Any design or best practice advice would be helpful here.
Is it common practice to write a program to connect via FIX and leave it running for the entire session time? Or is it acceptable to close the program, given I don't send a logout message, and reconnect at a later time in the day?
I don't know what others have done, but I used QuickFIX with Python for years and never had any problem running my system all day, OR shutting it down periodically for whatever reason and reconnecting. In the end I wound up leaving the system connected for weeks at a time, since that allowed me to record data.
I would say that the answer to both of your questions is YES. It is common to leave it running. Also, it is acceptable to just close the program.
There can always be edge cases and idiosyncratic features of your implementation and your counterparty, so you should seek to understand more why they have asked you not to disconnect. That sounds very strange to me. Is their FIX engine not capable of something very simple and standard?
Yes it is common to keep the FIX sessions running for a long time. That should not be an issue.
You can't just shutdown your program your end, as Session-level FIX.Heartbeat(35=0) messages, sent periodically (usually 30s), as meant to keep the underlying TCP connection "open", and check that both ends are still up and running properly.
By the details you gave, if your vendor (which is likely the acceptor side) requests it, it might be because they need to send you messages, with no delay as they occur.
If you (the initiator side) are not logged in at that time, they won't be able to send those messages, as they won't be able to initiate a session with you.
The vendor might monitor sessions as well, but as an initiator, it sounds odd.
as initiators are waiting for connections.
More likely they will monitor unexpected sessions drops.
All in all, it very depends of your vendor anyway, you have to follow what they say...
I have searched tutorials and documentation for gevent, but seems that there isn't lots of it.
I have coded Python for several years, also I can code PHP + JavaScript + jQuery.
So, how would I create Omeglish chat, where one random person connects and then waits for another one to connect? I have understood that Omegle uses gevent, but my site would have to hold 200 - 1000 people simultaneously.
Besides the server side, there should be fully functional client side too and I think it should be created with jQuery/JavaScript.
I would need little help with the coding part. I can code Python well, but I have no idea how I would make that kind of chat system nor what would be the best Python library for it.
The library doesn't have to be gevent but I have heard that it's very good for stuff like this.
Thanks.
If I've understood you right, you just need to link the second person with someone connected before. Think it's simple.
The greenlet working with a person who comes first ('the first greenlet') just register somewhere it's inbound and outbound queues. The greenlet working with the second person gets this queues, unregister them and use for chat messages exchange.
The next person's greenlet finds out that there is no registered in/out queues, registers its own and waits for the fourth. An so on.
Is it what you need?