Good day! I want to implement payment acceptance using QIWI in discord, but I don't quite understand how I can link the QIWI API library and the Discord.py library. Programming language: Python.
Keep in mind to include what all you have and what all you have tried in your question, so that we can review what you have, improve it, give suggestions on it in order to fix it :)
Here are some useful resources on QIWI
QIWI Official API Docs
pyqiwi package documentation
pyqiwi Quick Start
And here are some useful resources on discord.py
discord.py official documentation
discord.py Quick Start
discord.py bot examples
A basic bot application can be created as such using discord.py
from discord.ext import commands
# Bot instance
client = commands.Bot(command_prefix="!")
# a simple ping command that will reply with "pong" when you use.
#client.command()
async def ping(ctx):
await ctx.send("pong")
# bot token can be accessed from discord developer portal
client.run("token")
Related
Is it possible to have a discord application be authorized specifically for the purpose of adding members to a server and then joining it for them?
You'll need the user to grant your application the guilds.join scope.
As described in the Discord API docs, you need a bot user already in the server for this (emphasis mine):
guilds.join and bot require you to have a bot account linked to your application. Also, in order to add a user to a guild, your bot has to already belong to that guild.
discord.py, however, does not have built-in support for this behaviour as far as I'm aware. You'll need to implement the OAuth2-Flow for yourself (Discord themselves have a Python example on their GitHub page that you can take inspiration from)
So I came across a bot called GameBot, and when you send a command, it sends buttons like so:
picture
an anyone tell me how they did this??
Buttons are a new discord feature that are not yet supported by the official discord.py library.
There is however a third party library called discord components that is mentioned above, however, it is best to wait until it is supported by discord.py
There is currently no ETA on when buttons and slash commands will be supported however it will be a lot more beneficial to wait than use third party services.
This is a new Discord feature. I personally use this feature for my bot too since the discord-buttons library is outdated, you can use the discord-components library instead.
I've been using for member in guild.members (or ctx.guild.members) since creatting my bot this spring and its worked no problem. Then one day, it only lists the bot itself.
Did we get a new version of discord.py or something?
Discord.py 1.5.0+ requires you to enable "Intents". In order to get a member list of a server, you will need to enable the server member intent in the discord developer portal (Click your bot application, and go to the bot tab), take a look at this link: https://discordpy.readthedocs.io/en/latest/intents.html#privileged-intents if you can't seem to find it. After you have done that, you need to do this in your code too.
For the code part, i think it's easier if you take a look at the discord.py docs yourself.
can I use some methods from here - Telegram API for my Telegram Bot. I am asking because I need in a methods which no present in Telegram Bot Api. If yes, please write How I can to do that.
No, you can't. Those methods are for Telegram Clients, not for bots. Bots can only use the methods listed here.
As the other contributor has already answered, you can't normally use Telegram API inside bots.
But you can actually leverage some libraries like (MadelineProto (php), Pyrogram (python), Telethon (python), etc...) to create a userbot instance behind the scene and the bot can delegate the tasks that requires Telegram API to the userbot in the background.
I want to build a custom chat bot (using Google Hangouts Chat) that will answer requests like "Sales 08-03-2018 in $" -> "$500000". I have the data in AWS Redshift. I can use psycopg2 that connects Redshift using Python. Are there any APIs that will directly connect to Redshift or MySQL and send these aggregation results back to my bot giving an answer to the required question? If not, what are the alternate ways to do this? Also, can anyone tell me where do we run the Flask code? I am new to this, and it will be really helpful if someone could just brief me about where to code and run. I have a G Suite account that has enabled the Hangouts Chat API. Please help.
Thanks.
You pretty much have everything you need to build this solution and don't need any specific APIs to do the work (unless you want to build this one solution to serve other users).
Write your bot in Python (obviously since you're already doing that)
Use psycopg2 to access Redshift as you've already stated
Your bot app aggregates the results from psycopg2+Redshift
Format your output in JSON and return it to Hangouts Chat
Use Google App Engine to host your app; it supports Flask
Start with this simple, synchronous Flask App Engine sample bot
If your bot can't respond immediately, make it asynchronous; check out this equivalent async Flask bot
If you want your data/results to look good in Chat, check out this 3rd Flask sample bot featuring interactive cards which allow for formatted visual output
Once your app is running on App Engine, register its YOUR_APP.appspot.com (or custom domain) endpoint in the Hangouts Chat "Configuration" tab under "Connection settings" -> "Bot URL"
Check out all the Hangouts Chat developer docs here
You can also run Flask on any other PaaS or IaaS instances that supports it.
Also read this for more about the platform itself as well as other ways to create+host bots
Similar idea from Motorola Solutions CIO per his Mar 2018 post... fetch & tie together data then present results in a chat room