Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 months ago.
Improve this question
I would like to create a bot that sends a request (post) via a command /refresh with certain information so where I say /refresh test and it then sends a POST with certain information that is given for the time being.
Like this
client_id=CLIENT_ID_HERE&client_secret=CLIENT_SECRET_HERE&refresh_token=REFRESH_TOKEN_HERE&grant_type=refresh_token&redirect_uri=REDIRECT_URI_HERE
but don't know how.
So I reread this now many times. If I understood it right now, you just want to post something to, for example https://example.com/post
If so, then use aiohttp and create a client session and post it.
import aiohttp
#this in your command
async with aiohttp.ClientSession() as session:
await session.post(“https://example.org/post“, data={“foo”:”bar”})
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed yesterday.
Improve this question
I have a telebot project where one of the function is sending message to user information from SQL table.
For example, user sends request with some data to Telegram bot. Then this data is sending to SQL table and create a new record. I see the new record and change, for example, status from 0 to 1. And when I updated data in user's record in SQL, I need the bot send to user a message that 'status' is changed.
Bot how can make 'check procedure' in Bot (to wait until SQL data is updated)?
I have no ideas. Please, share your thoughts!
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I am creating a system the detects if a bot sent my bot a message, if so, it'll alert me to my server with a webhook. But unfortunately, it hasnt been working.
I tried message.user.bot but it doesn't work the way I intended it to. Is there a correct function to determine if the message author is a bot?
Use message.author.bot.
For example this:
#bot.event
async def on_message(message):
if message.author.bot:
pass # whatever here
await bot.process_commands(message)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
My goal is to be able to loging to Discord using a script and then be able to send messages to channels. I need it to communicate with a music bot automatically but if I write a bot for discord other bot's will ignore it so thats not an option. Does anyone know how to do it?
Thanks!
I strongly advise you not to pursue this goal further, as it is a violation of the Discord Terms of Service and is illegal.Probably your account will be terminated by Discord as a result.
If you want to automate Discord Bots you can take it into consideration to code your own.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I want to block an entity like user or bot with a user account. I cannot find any method for that. Also, it's good to exist some method for unblock entities.
You need to use what is known as raw API. Searching for "block" takes us to BlockRequest which comes with an example:
from telethon.sync import TelegramClient
from telethon import functions, types
with TelegramClient(name, api_id, api_hash) as client:
result = client(functions.contacts.BlockRequest(
id='username'
))
print(result)
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I need to design a API where a request is made to the URL and in turn return a response.
Now i do not want to use any framework as such.
So my question is how can i make this happen.I want to send a request from the web browser and get the response.I have the apache server setup.So where should my python code leave to receive the request and how to respond back
EDIT
import urllib2
request = urllib2.Request('http://localhost/')
request.get_method = lambda : 'HEAD'
response = urllib2.urlopen(request)
response.info().gettype()
Try Flask, it's a microframework and setting it up should be a one-liner.
http://flask.pocoo.org/
Here're the docs for configuring Apache to run it:
http://flask.pocoo.org/docs/deploying/mod_wsgi/
I know you said no frameworks, but this is a lot more simple than doing it yourself.