bots

How to capture output of subprocess.call

妖精的绣舞 提交于 2021-02-10 05:14:30
问题 I have made a script that tells me the temperature of my Raspberry Pi 3, but there is a problem with the script. The result output is the bot saying "Your RPI3 temp is currently 0". What is wrong with my code? @bot.command(pass_context=True) async def vcgencmdmeasure_temp(ctx): if ctx.message.author.id == "412372079242117123": await bot.say("OK....") return_code = subprocess.call("vcgencmd measure_temp", shell=True) await bot.say("KK done") await bot.say("Your RPI3 temp is currently: {}"

How to capture output of subprocess.call

浪尽此生 提交于 2021-02-10 05:13:34
问题 I have made a script that tells me the temperature of my Raspberry Pi 3, but there is a problem with the script. The result output is the bot saying "Your RPI3 temp is currently 0". What is wrong with my code? @bot.command(pass_context=True) async def vcgencmdmeasure_temp(ctx): if ctx.message.author.id == "412372079242117123": await bot.say("OK....") return_code = subprocess.call("vcgencmd measure_temp", shell=True) await bot.say("KK done") await bot.say("Your RPI3 temp is currently: {}"

How to Block All Bots Inluding Google Bot, and All Other Bots With Htaccess

耗尽温柔 提交于 2021-02-08 09:24:23
问题 How can i block all Bots with htaccess. All bots means all Bots, Not even Google or any Bot Should Access My Site. I am Using custom index.html Page in my site, and in back-end Wordpress is also installed. 回答1: There is no way to ban all, but you could ban some well known ones. To block Google, Yandex, and other well known search engines, check their documentation, or add HTML robots NOINDEX, nofollow meta tag. For Google check Googlebots bot doc they have. Or simply add Google bots:

Python: Not getting the response for Message Back action in MS Teams Adaptive Cards

感情迁移 提交于 2021-02-07 10:44:17
问题 I am new to Python and have been trying to integrate it with MS Teams using an outgoing webhook. I have created a simple web service to handle post request using flask and I am hosting it using ngrok and the resulting URL from ngrok have been used as the Outgoing webhook callback URL in teams. I am able to receive message in my service and send an adaptive card as response. But if I fill out the information and click Submit I get 'Something went wrong. Please try again' error and I am not

How would I be able to create a bot in python that inputs text into a webpage [closed]

醉酒当歌 提交于 2021-02-07 04:38:11
问题 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 4 years ago . Improve this question What code would I use to input text into a box (not edit text, something along the lines of a message bot)? Say I run the code, it opens a webpage and inputs text into a (e.g.) search box. Thanks! 回答1: You can use the Selenium library to create a bot in

How can I make a random response in Discord.js

和自甴很熟 提交于 2021-02-05 11:56:19
问题 The title explains it I guess. I have no code written down and it would be nice if someone explains the steps to the code. I want it to send a random link for a wallpaper from a website each time the command 'a wallpaper' is used. Any helpers? 回答1: client.on('message', (message) => { if (message.content.startsWith('!wallpaper')) { // Here you can choose between creating your array with your own links or use a api that will generate it for you. For now i'll use an array const wallpapers = [

How can I make a random response in Discord.js

烈酒焚心 提交于 2021-02-05 11:56:11
问题 The title explains it I guess. I have no code written down and it would be nice if someone explains the steps to the code. I want it to send a random link for a wallpaper from a website each time the command 'a wallpaper' is used. Any helpers? 回答1: client.on('message', (message) => { if (message.content.startsWith('!wallpaper')) { // Here you can choose between creating your array with your own links or use a api that will generate it for you. For now i'll use an array const wallpapers = [

How to scrape the first element of each parent using from The Wall Street Journal market-data quotes using Selenium and Python?

て烟熏妆下的殇ゞ 提交于 2021-02-05 10:46:21
问题 Here is the HTML that I'm trying to scrape: I am trying to get the first instance of 'td' under each 'tr' using Selenium (beautifulsoup won't work for this site). The list is very long so I am trying to do it iteratively. Here is my code: from selenium import webdriver import os # define path to chrome driver chrome_driver = os.path.abspath('C:/Users/USER/Desktop/chromedriver.exe') browser = webdriver.Chrome(chrome_driver) browser.get("https://www.wsj.com/market-data/quotes/MET/financials

Sending message every minute in discord.py

巧了我就是萌 提交于 2021-02-05 09:44:44
问题 I am trying to make the bot send a message every minute in discord.py. I do acknowledge that this is a easy thing to do but I have tried multiple times but resulting with no luck. I have not gotten any error messages. Here is my code: import discord from discord.ext import tasks client = discord.Client() @tasks.loop(minutes=1) async def test(): channel = client.get_channel(CHANNEL_ID) channel.send("test") test.start() client.run(TOKEN) 回答1: You try to get channel with get_channel() , but your

Sending message every minute in discord.py

会有一股神秘感。 提交于 2021-02-05 09:44:07
问题 I am trying to make the bot send a message every minute in discord.py. I do acknowledge that this is a easy thing to do but I have tried multiple times but resulting with no luck. I have not gotten any error messages. Here is my code: import discord from discord.ext import tasks client = discord.Client() @tasks.loop(minutes=1) async def test(): channel = client.get_channel(CHANNEL_ID) channel.send("test") test.start() client.run(TOKEN) 回答1: You try to get channel with get_channel() , but your