Using an AI Bot to Make a Reddit Bot

Michael Figures It Out
26 May 202318:25

Summary

TLDRThe video outlines how to create a Reddit bot using Bing AI chat to automatically find and repost prompts from Reddit's r/midjourney subreddit. The goal is to help people access prompts to create their own AI generated images. The narrator starts by explaining why he prefers to use Bing chat over ChatGPT for coding - mainly the lack of need for a phone number and more capabilities. After asking Bing to generate Python code for a Reddit bot using the Python Reddit API Wrapper (PRAW), the narrator copies the code into an editor to make tweaks over multiple iterations. Key steps covered include getting Reddit API credentials for the bot, registering the bot as a Reddit user, adding code for authorized Reddit instance creation, searching specific criteria like posts with “imagine” and “prompt” keywords, cross-posting qualifying posts to a new subreddit, and commenting the matching prompt text. Several coding best practices are suggested such as: using Bing's Precise mode for writing code instead of Creative; adding print statements to debug code; using comments liberally; writing prompts in a separate doc before entering into Bing; and version controlling code on GitHub. The narrator also stresses the importance of collaborating with Bing during coding by asking clarifying questions about snippets of code. This helps uncover issues like deprecated search methods, incompatible date range logic, and submission vs comment searching. In the end, the fully functioning bot automatically scans new Reddit posts for prompts, cross-posts them to a new subreddit, and comments with the matched prompt text.

Takeaways

  • Bing chat can generate Python code for building a Reddit bot
  • The Python Reddit API Wrapper (PRAW) is used for Reddit bot development
  • Bing gave step-by-step guidance on getting Reddit API credentials for the bot
  • Print statements are critical for debugging Python code
  • Asking Bing clarifying questions helps co-author better code
  • Storing prompts separately allows revising and combining them
  • Splitting up code into logical sections makes it more readable
  • Bing doesn't get annoyed by repeated questions
  • Bing suggested ways to work around prompt length limits
  • Sharing code on GitHub allows others to reuse and build on it

Q & A

  • What Python module is used for accessing the Reddit API?

    -The Python Reddit API Wrapper (PRAW) module enables Python code to interact with the Reddit API.

  • How can you debug Python code effectively?

    -Add print statements throughout the code to output variable values and check program flow and logic.

  • Why store chat prompts separately from coding them?

    -Storing prompts separately allows revising, combining, and reusing them more easily without hitting chat limits.

  • What was the issue with duplicate Reddit submissions?

    -The code was cross-posting every qualifying comment, instead of checking if a submission already existed.

  • How can you expand the character limit in Bing chat?

    -Bing showed how to increase the limit from 2,000 to 25,000 characters by altering the webpage HTML, but this may violate terms of service.

  • What is a benefit of posting code publicly on GitHub?

    -Sharing code on GitHub allows others to reuse it for their own projects and build on it with improvements.

  • Why break code into sections instead of one long script?

    -Splitting code into logical sections like functions makes it more organized, readable, reusable, and maintainable.

  • What flair tags helped identify relevant Reddit posts?

    -The Showcase and Painted Over Edited flairs on /r/midjourney helped identify posts likely to contain prompts.

  • How did Bing assist in improving the Python code?

    -Bing gave recommendations for fixes, optimizations, and fail cases to handle - serving as a collaborative coding partner.

  • Why allow the bot code to be publicly reused?

    -Sharing useful code openly helps others learn and speeds innovation by building on previous work.

Outlines

00:00

Introducing the Reddit Bot Project

The video introduces a Reddit bot project to automatically find and repost prompts from the r/midjourney subreddit. It will use Bing chat to generate the Python code. The narrator provides background on Midjourney and the usefulness of sharing prompts. He explains the high-level goal of the project and bot.

05:01

Getting Reddit API Credentials

The narrator walks through the steps to get API credentials for the Reddit bot, including creating a separate Reddit account for the bot. He emphasizes keeping credentials private. An additional API registration is done though may not be required. The credentials allow the Python code to access and post on Reddit like an authenticated user.

10:02

Coding the Reddit Bot Logic

The initial coding process with Bing chat in creative mode is described. Debugging approaches like error messages and print statements are suggested. Bing's code is iteratively improved based on testing, errors, and the narrator's prompts. Functionality is added to search posts, handle errors, avoid duplicates, and meet the cross-posting objective.

15:04

Refining the Code

Additional improvements are made through prompts to Bing, including: searching post text, adding triggers, making triggers case-insensitive, optimizing performance. The narrator also cleans up the code by putting triggers in a set and renaming variables for clarity. The code structure is split to separate comment and submission searching. Flair filters are added.

Debugging Issues

Several examples are provided of debugging issues in the code by probing Bing for explanations of its logic and suggestions. This helps resolve problems with: duplicate posts, cross-post checks, trigger formatting. Bing's responses illustrate how it can assist with troubleshooting.

Tips for Working with AI

Useful tips are shared for collaborating with AI like Bing on a coding project. These include: recording prompts separately, being an active partner, using precise prompts, avoiding confusion on terminology, and handling code truncation.

Completing a Working Bot

The final steps are described including testing real-time commenting and ensuring all comment types are checked. The complete bot code is posted to GitHub. Future videos on deployment, logging, and maintenance tools are mentioned.

Interesting Bing Chat Hack

As an aside, Bing's suggestion to alter the HTML to expand the chat prompt size limit is discussed. This reveals Bing's intricate but limited understanding of its own interface.

Mindmap

Keywords

💡Reddit bot

A Reddit bot is an automated program that interacts with Reddit, typically to perform repetitive tasks. In this video, the narrator creates a Reddit bot in Python that searches the r/midjourney subreddit for image prompts and crossposts them to another subreddit.

💡midjourney

Midjourney is an AI image generation model that creates images based on text prompts. The Reddit bot in the video searches for Midjourney prompts posted on Reddit so they can be shared more widely.

💡prompt engineering

Prompt engineering refers to the crafting of text prompts to get better outputs from AI image generators like Midjourney. The video explains that studying and modifying other users' prompts is a good way to improve one's own prompt engineering skills.

💡crosspost

On Reddit, crossposting means posting content from one subreddit to another. The video bot automatically crossposts image prompts from r/midjourney to another subreddit created by the narrator.

💡API

API stands for Application Programming Interface. Reddit provides APIs that allow third-party programs like bots to interact with Reddit by searching posts, commenting, crossposting, etc.

💡Google Cloud

Google Cloud is a cloud computing platform that provides virtual machines to host applications online. The narrator mentions eventually deploying the Reddit bot on Google Cloud.

💡coding assistant

The narrator uses the Bing chatbot as a coding assistant to collaboratively write the Python code for the Reddit bot. The chatbot suggests code, explains concepts, and helps debug.

💡print statements

Print statements in code print output messages that help debug issues. The narrator adds print statements throughout the development process to understand what the code is doing.

💡duplicate posts

At one point, the Reddit bot was accidentally crossposting duplicate posts. The coding assistant helped add logic to check if a crosspost already existed before posting.

💡deployment

Deployment refers to installing code into a production environment. After completing development on his PC, the narrator plans to deploy the Reddit bot script on Google Cloud.

Highlights

Bing chat bot helps code a Reddit bot in Python to automatically find and share Midjourney AI image prompts

The bot scans the Midjourney subreddit for posts with prompts, then cross-posts them to a new subreddit

Coding bots with Bing chat using the Precise style focuses on factual, concise answers for writing code

Add print statements to Python code so you can see what the code is doing at each step

Write code prompts separately before entering them into Bing chat to refine questions

Q&A process with Bing helps debug code issues and understand how the code works

Supplemental mini programs checked for cross post ability and other functions outside main bot code

Check for code cut-offs in Bing responses and request the missing portions

Revised code to separately check submissions versus comments for prompts to simplify

Manual workaround code prevented duplicate cross posts of multiple comments

Final Reddit bot code posted to GitHub, next steps include deploying bot on Google Cloud

Bing gave HTML hack to expand chat response character limit from 2,000 to 25,000

Possible Bing doesn't realize it's interfacing through a browser, like a "brain in a jar"

Inspires coding your own AI-assisted bots for Reddit or other platforms

Upcoming videos on deploying, logging errors, maintenance checks for Reddit bot

Transcripts

play00:00

this is my Reddit bot MJ prompt bot it

play00:03

lives on the Google cloud and monitors

play00:05

the mid-journey subreddit 24 7 for free

play00:08

if you're curious how to make a Reddit

play00:10

bot even though your coding skills are

play00:12

Rusty or non-existent then keep watching

play00:14

because my name is Michael and I figured

play00:16

out how to use Bing chat to create my

play00:18

first Reddit bot so I use the bot to

play00:20

make a bot actually I used a bot to make

play00:23

a bot to help people use another bot

play00:25

let me jump right in and I'll explain

play00:27

everything as I go along I promise Bing

play00:29

is the AI chat bot I prefer for coding I

play00:31

use it over the more famous chat GPT

play00:33

because Bing is also free but doesn't

play00:36

require a phone number and currently has

play00:38

more capabilities than chat gbt you need

play00:40

to have a Microsoft account and use the

play00:42

edge browser for big chat there are ways

play00:44

to get it working on other browsers but

play00:46

I was fine with Edge I started by asking

play00:48

Bing can Bing code in Python being

play00:51

responded Yes so I asked if it could

play00:53

generate python code for Reddit bot Bing

play00:55

said sure and then talked about Pro

play00:57

turns out pra is an acronym for the

play01:00

python Reddit API wrapper which you need

play01:02

to code a Reddit bot in Python I didn't

play01:04

know about prop but Bing did thank you

play01:07

bing bing also gave me sample code for a

play01:09

simple hello world response bot Q at the

play01:12

end it mentioned that my bot could be

play01:14

deployed for free on a cloud platform

play01:16

like Heroku to make it run continuously

play01:18

this was wrong but we'll get to that in

play01:20

another video so now that Bing and I are

play01:22

vibing I hit it with the bot I want to

play01:24

make I ask can you you code a Reddit bot

play01:27

in Python that will find any comment in

play01:29

the mid-journey subreddit that contains

play01:30

the phrase imagine and was made by the

play01:33

user that submitted the post and then

play01:34

cross post that post as a new Post in

play01:37

the MJ prompt bot subreddit and post a

play01:40

comment to that new post that is a copy

play01:42

of the found comment

play01:44

what let me explain mid-journey is a

play01:48

text to image AI that generates really

play01:50

cool images based on text prompts you

play01:52

communicate your prompts to Mid journey

play01:54

through a Discord bot prompts are also

play01:56

how I talk to the Bing chat bot prompt

play01:58

engineering is an art and a science and

play02:01

for image generating AIS it's a lot of

play02:03

trial and error giving you only have a

play02:05

finite amount of processing time with

play02:07

mid-journey a good way to get better at

play02:09

crafting prompts is by looking at other

play02:11

people's prompts and the images those

play02:13

prompts created then you copy the bits

play02:15

of the prompts from the images you like

play02:16

and build from there a popular place to

play02:19

share mid-journey picks is the mid

play02:21

Journey subreddit on Reddit but very few

play02:24

posters include their prompts people

play02:26

often complain about this on the

play02:27

subreddit that's where my bot can help

play02:30

mybot scans the mid-journey subreddit

play02:32

and when it finds a post with a prompt

play02:34

it cross-posts it to a subreddit I

play02:37

created called MJ prompt bot it's the

play02:39

same name as my bot before you can run

play02:41

your code you'll need to get your Bots

play02:43

credentials from Reddit Bing lists out

play02:45

the steps here and I'll run through them

play02:47

in the video so you can slow it down and

play02:48

pause to see the details by the way

play02:50

don't worry if your Reddit looks

play02:51

different from mine I'm using old Reddit

play02:53

with some plugins but I check the

play02:55

current version and it's exactly the

play02:57

same process you might want to create a

play02:59

new Reddit account to run your Bot I

play03:01

created mfiobot as my Reddit account for

play03:03

my bot so if something went horribly

play03:05

wrong it wouldn't mess up my main Reddit

play03:07

account

play03:08

you should also read the developer terms

play03:10

and API terms there will be links to the

play03:12

pages you'll see here when you click the

play03:15

create app at the bottom of the page it

play03:17

gives you your Bots credentials below

play03:19

that you can see the same create

play03:20

application form you just completed with

play03:23

some of the fields already filled in you

play03:25

can ignore that it's just there in case

play03:26

you want to make a bunch of the same bot

play03:28

for our purposes we just need the one

play03:30

bot and now we have what we need it's

play03:32

credentials but when you scroll down

play03:34

you'll see there's a link that says You

play03:36

must also register to use the API API

play03:39

stands for application programming

play03:40

interface and it allows your Python

play03:42

program to interact with the reddit

play03:43

website similar to the way you use the

play03:45

Reddit app or the Reddit browser to

play03:47

interact with Reddit to be honest I'm

play03:49

not sure that the API registration is

play03:51

required because you already have your

play03:53

Bots credentials before registering but

play03:56

I just didn't want to risk my bot not

play03:57

working due to technicality so I went

play03:59

through the whole process you'll put the

play04:01

credentials from the page where you

play04:02

created the bot plus your Reddit account

play04:04

username and password for the one

play04:06

controlling your Bot into your code to

play04:08

create an authorized Reddit instance

play04:10

this allows the bot to search and post

play04:12

on Reddit the same way you enter your

play04:13

ready a username and password before you

play04:16

can post or do things on Reddit these

play04:18

need to be private I'm showing mine here

play04:20

so you can see what they look like and

play04:22

where they go but I deleted these

play04:24

afterwards and redid the whole process

play04:26

off camera to get my bots real

play04:27

credentials the ones I'm using now so

play04:30

the code you see later on in this video

play04:31

will just be using credential

play04:33

placeholders I had one more step before

play04:35

I jump back into coding because I

play04:37

created the MJ prompt bot subreddit with

play04:40

my main Reddit account and also made it

play04:42

private I had to add my bot as a user of

play04:45

that subreddit so it could post there

play04:46

I'll make the subreddit public once the

play04:48

bot is fully operational

play04:50

back to coding Bing responded to my

play04:52

prompt with some code I copy and paste

play04:54

that code into notepad or directly into

play04:56

a py file that's also where I make any

play04:59

changes to the code that Bing suggests

play05:01

later I run the code on my PC and in a

play05:04

later video I'll show how I upload the

play05:06

py file to the cloud so it can run 24 7

play05:09

on a virtual machine so to code your Bot

play05:11

with Bing you'll need to install python

play05:13

on your computer I've seen Reddit bots

play05:16

in action but I didn't know how they

play05:17

actually searched Reddit so I asked Bing

play05:20

and found out my bot was coded to search

play05:22

new posts as they are made that might be

play05:24

fine when the bot is up and running

play05:25

perfectly but for testing it meant I

play05:27

would need to wait for new posts that

play05:29

had prompts in order to know if my code

play05:31

was working I hate with

play05:34

me too an ego so I advise the code to

play05:37

search a date range then I ran the code

play05:39

for the first time I actually thought it

play05:41

would work so I recorded myself here it

play05:43

is

play05:46

okay

play05:49

and nothing happened okay

play05:52

all right let's try to figure it out

play05:55

Pro tip run your code from the python

play05:57

editor instead of just running the pi

play05:59

file so you can actually see the error

play06:01

messages in the python shell now that

play06:03

you can see the error messages you can

play06:05

copy them and paste them into Bing to

play06:07

debug your code sometimes I say here's

play06:09

an error I received and I paste it in

play06:11

and other times I just copy it into the

play06:13

chat and Bing realizes what I'm asking

play06:15

especially when we're already discussing

play06:17

the code my first error was having a

play06:19

quotation mark in the bot's username

play06:21

which messed up the credentials my

play06:23

second error was that I didn't install

play06:25

Pro took me a while to realize that it

play06:28

needs to be installed from the Windows

play06:29

command line not the python editor Bing

play06:32

help me with that but even after fixing

play06:34

my newbie mistakes the code still

play06:36

produced an error so I plug the error

play06:38

into Bing and it told me the search

play06:39

method in my code was depreciated and

play06:42

would be removed in the next version

play06:43

that was annoying because I don't want

play06:45

to have to change the code when Pro is

play06:47

updated but I expect the issue was

play06:49

caused by using the creative style Bing

play06:51

chat has three Styles the creative mode

play06:54

generates longer more imaginative

play06:56

answers while the precise mode focuses

play06:58

on shorter factual answers the balance

play07:00

mode aims to provide a balance between

play07:02

the two Styles these styles are very

play07:04

important I started using the creative

play07:06

style to write my code but later learned

play07:08

if you're going to write code precise

play07:10

style is the way to go you can tell

play07:12

which style you're using based on the

play07:13

color purple blue or green

play07:16

after a few iterations my code ran

play07:18

without errors but didn't cross post

play07:20

anything oddly I could not figure out if

play07:23

the date range was correct being in the

play07:25

internet gave me conflicting answers

play07:26

it's possible I was checking dates in

play07:28

the future that didn't have posts yet or

play07:31

posts too far in the past so I had Bing

play07:33

revised the code to post in my subreddit

play07:35

if the bot did not find any comments in

play07:38

its search and it posted this was a huge

play07:40

relief because I knew if it could post

play07:42

it could search now that I knew my bot

play07:44

could work I started over with the

play07:46

precise style but the same prompt being

play07:48

used a different approach and set up the

play07:50

code to search the first 10 new posts

play07:53

this meant the code would check the 10

play07:55

most recent existing posts so I didn't

play07:57

have to wait for new posts to come in

play07:58

and no more messing around with wonky

play08:00

date ranges still no cross posts so Bing

play08:03

suggested a print statement let me see

play08:05

what the bot was checking brilliant and

play08:07

that's another Pro tip you should always

play08:09

add print statements so you could see

play08:10

what your code is doing comments which

play08:13

are anything after the hash or pound

play08:14

sign are also a lifesaver Bing suggested

play08:17

opening up my search criteria to trigger

play08:19

words and comments by any user but I

play08:22

knew the original poster of the picture

play08:23

would be the only one able to comment

play08:25

with the real prompt so I ignored Bing's

play08:27

suggestion here I switched my code to

play08:30

search hot posts as I figured these more

play08:32

popular upvoted posts had a better

play08:34

chance of having prompts in the comments

play08:36

but I got an error with Bing's help and

play08:38

the print statement I could see it

play08:40

crashed because the code was checking an

play08:42

announcement post made by a moderator

play08:44

those posts don't register as having a

play08:47

proper author so Bing was able to fix

play08:49

that by checking if there was no author

play08:51

and skipping those posts once the error

play08:53

was corrected I got my first real cross

play08:55

post this is exactly what I wanted it

play08:58

even commented with the prompt I asked

play09:00

Bing to suggest more triggers and it did

play09:02

it also added them to the code without

play09:04

me even asking I also added that the

play09:06

trigger should be case insensitive

play09:08

meaning that if somebody capitalizes any

play09:10

of the letters my thought will still

play09:12

pick them up this reminds me don't be

play09:14

afraid to tell Bing to clean up the code

play09:16

here I noticed it was repeating my

play09:18

trigger terms in each Loop so I asked

play09:20

Bing to put them all into one set and it

play09:22

did in my final code I settled on

play09:25

imagine prompt and the Double Dash often

play09:28

used in mid-journey prompt codes and I

play09:30

removed any slashes or colons because

play09:32

although the mid-journey bot uses them

play09:34

in its prompts sometimes people don't

play09:36

include them when posting their prompts

play09:37

to the mid-journey subreddit later I

play09:39

noticed a post that had the prompt in

play09:41

the text of the post itself rather than

play09:43

in the comments I wanted to search that

play09:45

text so I plugged the link to that post

play09:48

into Bing and asked it to tell me if it

play09:50

would trigger my code to cross post Bing

play09:53

could see the post I was referencing

play09:55

even though it was only made recently

play09:56

and basically ran my code on it it told

play09:59

me that my bot would not catch this post

play10:02

so without me asking Bing provided the

play10:04

revised code to include the submission

play10:06

self-text in the search for prompt

play10:08

triggers then Bing suggested that this

play10:11

change might catch posts without prompts

play10:14

such as question or discussion posts so

play10:17

it added the prompt flare as a search

play10:19

criteria for posts Reddit flare is a way

play10:21

of tagging your posts with a label that

play10:23

helps categorize it question and

play10:25

discussion are flares that are used on

play10:27

posts in the mid Journey subreddit stop

play10:29

for a second and think about how Wild it

play10:31

is that Bing seemed to get what I was

play10:33

doing so well that it could actually

play10:35

make this suggestion I was blown away

play10:38

but then I checked and I found the

play10:40

mid-journey subreddit doesn't have a

play10:43

prompt flare so I told Bing to remove

play10:45

that from my code this is a great

play10:47

example of how much AI can do and how it

play10:50

can stumble I later added a flare check

play10:52

back in for the Showcase and painted

play10:54

over edited flare I also checked to make

play10:57

sure the mid-journey subreddit wouldn't

play10:59

let you post with flair being blank just

play11:01

in case I needed to check for no flare

play11:03

luckily Flair is required so I didn't

play11:05

have to allow for that in my code keep

play11:07

in mind that you're co-authoring the

play11:09

code with Bing working together to

play11:10

complete your project you need to have a

play11:13

general understanding of how the code

play11:14

works so ask questions as you go along

play11:16

here I asked Bing why it added a break

play11:19

at the end Ben gave me the stock answer

play11:21

from the broad documentation that the

play11:23

break statement is used to exit a loop

play11:24

prematurely but then it said in this

play11:27

case I added it to stop the bot from

play11:29

checking more replies to the thank you

play11:31

message after it has deleted the cross

play11:33

post this is to avoid unnecessary work

play11:36

and potential errors explaining why it

play11:38

used certain statements is fantastic for

play11:41

Learning and understanding your code by

play11:43

the way this was for code I considered

play11:44

adding to notify the original poster

play11:46

when my bot copied their post and

play11:48

allowing them to potentially delete it I

play11:50

eventually scrapped it when I found out

play11:52

Reddit automatically sends you a message

play11:53

when your username is mentioned in a

play11:55

comment another way this helps is the

play11:57

closer you get on the language the more

play11:59

precise your prompts for example I was

play12:01

calling these posts but I learned Pro

play12:04

calls them submissions so when talking

play12:07

with Bing from now on I started calling

play12:09

them submissions to avoid any confusion

play12:11

more importantly this q a process helped

play12:14

me debug an issue that plagued my code

play12:16

for days while trying to prevent

play12:18

duplicate cross posts the code would

play12:20

check if the cross posts existed in my

play12:22

MJ prompt bot subreddit and whether it

play12:25

was cross-post-able I questioned Bing

play12:27

about it but it didn't click for me

play12:29

until I wrote a separate program to

play12:31

check for cross post ability and it came

play12:33

up false for all my posts I finally

play12:36

realized the cross postable test was not

play12:38

only be completely unnecessary because

play12:41

it was being run on submissions already

play12:42

in the MJ prompt bot subreddit but it

play12:45

was also always false then confirmed my

play12:48

view and removed it I've made a few

play12:50

supplemental programs to help my bot but

play12:52

I'll go into those in a later video and

play12:54

remember unlike a person Bing won't get

play12:56

annoyed and stop helping you it even

play12:58

ignores spelling mistakes like here

play12:59

where I typed Cod instead of code it

play13:02

knew I wasn't talking about fish by this

play13:04

point I learned so much that I started

play13:06

all over with being using a big prompt

play13:08

incorporating everything I learned so

play13:10

far this was easy because I've been

play13:12

recording my prompts and Bing's

play13:14

responses in a separate Word document I

play13:16

would say this is another Pro tip write

play13:18

out your prompts separately like in word

play13:20

or notepad before putting them into Bing

play13:22

chat this lets you revise your prompts

play13:24

break them up or combine them and also

play13:27

reuse them if you hit the 20 prompt

play13:28

limit but be careful somehow doing this

play13:31

caused the Double Dash trigger in my

play13:33

code to become a single long Dash

play13:36

causing it to miss several prompt

play13:38

comments you can even see it here before

play13:40

I caught it much later took me a long

play13:42

time to find this one so be vigilant so

play13:45

now my bot will check new comments as

play13:47

they are made in the mid-journey

play13:48

subreddit instead of checking

play13:50

pre-existing comments this is how my bot

play13:52

is supposed to work on the cloud which

play13:54

is my ultimate goal so I first need to

play13:56

make sure it will work this way on my PC

play13:58

at home I ran the bot and posted a

play14:01

comment to one of my submissions to the

play14:02

mid Journey subreddit checked for a

play14:04

cross post to my MJ prompt bot subreddit

play14:07

and success now that the comments were

play14:10

being checked properly I asked Bing to

play14:12

add code to check submission self-text

play14:14

as my old code had after adding that I

play14:17

noticed there was a submission with the

play14:18

prompt in the title so I asked Bing to

play14:21

cover that too I had some issues and

play14:23

even checked my version of prop couldn't

play14:25

figure out what was wrong so I told Bing

play14:28

and it rewrote my code to search

play14:30

comments and submissions separately this

play14:32

is the basis of the actual code my bot

play14:34

uses now and the split makes things

play14:37

easier to understand when looking at the

play14:38

code itself now that the bot was

play14:40

checking comments and submissions

play14:41

separately I wanted to make sure only

play14:44

comments to submissions with the

play14:45

Showcase or painted over edited flare

play14:48

were being checked this was in the

play14:50

submissions check but I never asked Bing

play14:52

to put in the comments check until just

play14:54

now here's another Pro tip sometimes

play14:57

your code will get too long for Bing's

play14:59

response box and it'll cut off before it

play15:01

gives you everything if that happens you

play15:03

can simply tell Bing to just show you

play15:05

the part of the code that's missing

play15:06

either to say give me the last half or

play15:09

give me the piece after and then give

play15:11

some code where it cut off I noticed

play15:13

that when there was more than one

play15:14

comment in the same submission that

play15:16

triggered my bot it would cross post

play15:18

each comment to a new submission in my

play15:20

subreddit making duplicate submissions I

play15:23

asked Bing to check this in my starting

play15:25

over prompt but it didn't work I checked

play15:27

back and saw my prompt was a bit unclear

play15:30

on this point so I again asked Bing to

play15:32

revise the code so that before it cross

play15:34

posts a comment it checks the MJ prompt

play15:37

bot subreddit to see if the cross post

play15:39

submission exists and if it does it

play15:42

cross-posts the comment to that same

play15:43

submission in the MJ prompt bot

play15:45

subreddit but it didn't work and Bing

play15:48

suggested checking for existing cross

play15:50

posts manually I thought it meant for me

play15:52

to check it myself with print statements

play15:54

or something so instead I tweaked The

play15:56

Code by making cross posts singular in

play15:59

one line of code because it looked that

play16:00

way in other lines I got another error

play16:03

and I told Bing what I did Bing

play16:05

explained to me that what I did was

play16:07

completely wrong because I made it try

play16:09

to cross post and we're checking if a

play16:11

cross post already exists being reminded

play16:14

me the code that it already suggested is

play16:16

a workaround that checks for existing

play16:18

cross posts manually it gave me the

play16:20

suggested code again finally realizing

play16:22

that it meant the code would manually

play16:24

check for cross posts I used it sure

play16:27

enough Bing was right I made three

play16:28

comments to my sorcerer or Barbarian

play16:31

Post in the mid-journey subreddit and my

play16:33

bot picked them up and cross-posted them

play16:35

into the same submission on the MJ

play16:38

prompt bot subreddit then I stopped the

play16:40

bot and re-ran it added a new comment to

play16:43

my submission and that fourth comment

play16:45

was also cross posted into the existing

play16:48

post on the MJ prompt bot separated now

play16:51

my bot was complete I'll post all the

play16:54

versions of my code to GitHub and put a

play16:55

link in the description below I've had

play16:57

so much fun making this bot it's such a

play17:00

great feeling of accomplishment to get

play17:01

it up and running I hope the video

play17:03

inspires you to try it too in later

play17:05

videos I'll cover uploading and running

play17:07

the bot on the Google for free getting

play17:09

the bot to log what it's doing and any

play17:11

errors it encounters and creating

play17:13

maintenance and checking tools for the

play17:15

bot so like subscribe and hit the

play17:17

reminder Bell to get notified when I

play17:19

post those videos and as an added

play17:21

benefit for those of you who have stuck

play17:22

around to The Bitter End here's a crazy

play17:25

hack at some point I hit the 20 question

play17:27

limit while still working on my code I

play17:30

tried to copy and paste it back into

play17:31

Bing via the prompt box but it was too

play17:33

large I asked Bing how many characters

play17:35

can fit in the prompt box and it told me

play17:38

only 2 000 characters but then being

play17:41

volunteered to show me how to expand

play17:43

that to 25

play17:44

000 characters by altering the HTML of

play17:47

the page this fascinated me why was it

play17:50

allowed to do that my guess is that Bing

play17:52

chat does not know that it is

play17:54

interfacing with you through the Bing

play17:56

chat webpage on the edge browser but it

play17:58

knows there's such a thing as the Bing

play18:00

chat webpage because people talk about

play18:02

it on the web Bing is like a brain in a

play18:05

jar that knows what a jar is but just

play18:07

doesn't know that it's in one

play18:11

you don't know no I don't I'm not

play18:14

recommending you do this because it

play18:16

might violate the terms of service I'm

play18:18

just pointing out something interesting

play18:19

I found from Bing chat happy coding and

play18:22

I'll see you in the next video

Rate This

5.0 / 5 (0 votes)

日本語の要約は必要ですか?