#dev-contrib

1 messages ยท Page 78 of 1

gritty wind
#

So even if you setup one manually, it won't affect the pipenv

short snow
#

but if u are not into your virtual enivornment?

gritty wind
#

Yeah it's based on your project

short snow
#

since, when u update your pipfile, u need to run pipenv lock

gritty wind
#
  1. You don't, it does automatically if you install
  2. It's based on the project, so as long as you are in the same directory as the pipfile, it'll work correctly
short snow
#

bump

gritty wind
#

An issue was opened for it from sentry

#

Feel free to tackle if you think you've got a fix

#

Hmm or maybe I'm misremembering

short snow
#

.issue 1369

dusky shoreBOT
#

[404] #1369 Issue/pull request not located! Please enter a valid number!

short snow
#

is there

#

but not any for this

gritty wind
#

It opened one for the other issue right above that

#

.issue 1369 bot

short snow
#

yeah that is open

#

but not for battleship

gritty wind
#

Right, uhh I think the error handler might've eaten this one then

#

In that case, do you wish to open an issue for it, or should I?

short snow
#

u can go ahead

balmy sparrow
#

oh i didn't, this is the one pipenv seems to have made

gritty wind
#

In that case pipenv should be available within the environment

#

Does running pipenv after deactivating work?

balmy sparrow
#

Let me try, one second

#

Vsc tells me that pipenv isn't on path

#

do i add the pipenv executable to path?

gritty wind
#

I guess you could try?

balmy sparrow
#

oh, i've seen people here have some issue due to line endings or something? what is it supposed to be? vsc says I'm using CRLF right now

gritty wind
#

That's windows' default

#

Most programs use LF

#

That being said

#

If you commit CRLF files, git will automatically convert to LF

green oriole
#

and MacOS use CR because standards

gritty wind
#

It's just that the linting will change them all to LF as well, so it might appear as though you have changed all files

#

That won't make it to github though, it'll be fixed before then

#

You can set your git cloning settings so that it clones in LF

balmy sparrow
#

Oh right

#

iirc while installing git it had asked me to pick what to use

#

i have no idea what i picked

gritty wind
#

Then its probably a good idea you set it up now and reclone

#

before you start working

green oriole
#

If you left the default, it is CRLF

#

Although it is a setting you can set per repo or globally

gritty wind
#

git config --global core.autocrlf input will use whatever the repo uses for all your git clones

balmy sparrow
#

alright done, thanks for guiding me through this :D

gritty wind
#

Oh thanks for telling me

balmy sparrow
#

is there no lancebot equivalent to !ping of @stable mountain ?

green oriole
#

There isn't, I don't think there's really a need for it

balmy sparrow
#

fair enough

late wolf
#

But there's uptime lemon_happy

gritty wind
#

.uptime

dusky shoreBOT
#

I started up 2 days ago.

late wolf
#

hmm why does isn't it more specfic

balmy sparrow
#

sir lancebot's enemies must never find out when he sleeps

balmy sparrow
#

.issue 1355 bot

balmy sparrow
#

I've commented here, could I get assigned? Looks simple enough

gritty wind
#

Are you anand2312?

balmy sparrow
#

yep

gritty wind
#

I've assigned you a while ago, but didn't know who to ping lol

#

Yeah go ahead and start

balmy sparrow
#

Oh, thanks (I've changed my nickname here now)

#

I have a doubt; how do I get the helper role ID?

#

is it constants.Roles.helpers?

gritty wind
#

Yeah

#

that's the general staff role

balmy sparrow
#

Also, this is what I had in mind:

    @staticmethod
    def is_helper_viewable(channel: TextChannel) -> bool:
        """Check if helpers can view a specific channel."""
        helper_role = channel.guild.get_role(constants.Roles.helpers)
        overwrites = channel.overwrites_for(helper_role)
        overwrites.view_channel ...

channels where the overwrites are either None or True are both viewable if I understand permissions correctly

#

do i check for both cases? or are all the channels explicitly set to one option (true/false)

gritty wind
#

That would work, but I'm unsure how discord handles implicit permissions

#

I'm assuming the moderation channels are invisible to everyone, with explicit read permissions for moderators

balmy sparrow
gritty wind
#

In that case that should work

balmy sparrow
#

oh, what would be the "neat" way to do write that though?

#

(overwrites.view_channel is None) or overwrites.view_channel is what immedietely came to mind but that doesn't look nice

gritty wind
#

If it's none, helpers can't read it, and we want to treat it the same as False, no?

gritty wind
#

You'd have to check the overwrites for @everyone, and @helpers so it works in all channels helpers can see

#

but from there, you can just return
everyone.view or helpers.view

#

The intersection of those two permissions are the channels viewable by helpers

#

You can then group the none with the false

balmy sparrow
#

Right, let me try something like that

gritty wind
#

@patent pivot 1370 is a duplicate of

#

.issue 1309 bot

dusky shoreBOT
patent pivot
#

smh

gritty wind
#

Which in itself is a duplicate of

#

.issue 1016 bot

dusky shoreBOT
gritty wind
#

Or at least that's why my pr on 1309 was closed

patent pivot
#

lol

#

hm wait

#

yeah

gritty wind
#

Did the issue occur again within the last 20 days?

patent pivot
#

yeah

gritty wind
#

Interesting, that might mean 1309 isn't a duplicate

#

but in that case you should have a pr ready to go ๐Ÿค“

#

Hmm yeah I don't see how 1016 solves the issue

balmy sparrow
gritty wind
#

Well here's how I believe the setup to be:
python general - everyone
staff-social - helpers
mod-social - mods

None of these channels have explicit permissions except for the role listed besides them. The channels visible to helpers explicitly are only the staff channels. If the permission returns None on the other two channels, there'd be no way to determine if the channel should be used or not

#

If you combine everyone and helper role, you can make it work for public channels such as pygen, and staff channels, but not mod channels

balmy sparrow
#

Also, should I be making a branch on my fork to which I commit these changes?

gritty wind
#

Yeah, that's usually a good idea

#

This gist does an alright job of explaining the fork-and-pull workflow

#

It's completely cli, but you can do most of the steps on the github page too

balmy sparrow
#

Oh alright

tawdry vapor
#

@patent pivot GH bot seems to not be detecting reviews again

patent pivot
#

It is

tawdry vapor
#

Not the policy bot

#

I'm talking about your bot

#

The one that adds labels

patent pivot
#

oh yeah the bot is gone, we discontinued that

tawdry vapor
#

๐Ÿ˜ญ

patent pivot
#

I think it was decided that if we wanted to do that we'd use actions

tawdry vapor
#

Well, I liked those labels

#

Seems premature to discontinue the bot when we don't have an alternative in place yet

patent pivot
#

If they were used I can certainly bring it back

balmy sparrow
#

When I run pipenv run lint, it said it failed flake8; how do I see what went wrong?

gritty wind
#

It should be printed with the rest of the error, how are you running it?

balmy sparrow
#

or is the pipenv not found what's failing

gritty wind
#

Ok it failed in running flake8

#

Yeah

#

so, is pipenv currently installed globally?

balmy sparrow
#

yeah

gritty wind
#

so can you just type pipenv in console

#

without the python -m

balmy sparrow
#

oh no I meant it is on my main py3.8 install, it doesn't work without the python -m, says pipenv isn't a recognized command

gritty wind
#

So the flake8 thing iirc just calls pipenv run flake8, so if it isn't installed it'll error out

#

How were you installing flake8 again?

balmy sparrow
#

I'd installed it earlier with pip install

#

Was I supposed to install again now?

gritty wind
#

Oh again was just a figure of speech

#

And flake8 was a brain fart lol

#

how did you install pipenv when you got it to work

balmy sparrow
#

Deleted my old python install, reinstalled 3.8, pip installed pipenv

#

Then set up pipenv environment in pycharm

gritty wind
#

Hmm in that case it should've installed the pipenv command to your base system

#

Is python installed on the user or system?

balmy sparrow
#

What's the difference?

#

Oh, I think I installed python now on the system (it's path is now in C:/Program Files/Python/python38)
does on user mean when it is installed in the Users/... folder?

gritty wind
#

Yeah

#

I was trying to check, but I can't tell if it actually makes a difference

balmy sparrow
#

I know where the pipenv executable is, should I add it to path?

gritty wind
#

Is it under C:/Program Files/Python/Python38/Scripts

balmy sparrow
#

Nah it's in the Users folder I think. Does this mean I have another install of python on the user as well

#

yep it's in User/.../AppData/Roaming/Python/python38/Scripts

gritty wind
#

Possibly, but the more relevant part is that it did the pipenv install on your user, not system, which is why it isn't added to path

#

You could manually add it to path, but that might cause issues

gritty wind
balmy sparrow
#

pip, pip3.8, pip3 all there

gritty wind
#

Perfect, could you try running the install from that then

(in an admin cmd)
C:/Program Files/Python/Python38/Scripts/pip.exe install pipenv```
#

That should hopefully get it installed and added to path

balmy sparrow
#

Let me try that

#

After that would I have to do pipenv install and everything on the project again?

gritty wind
#

I think your pipenv environment will still exist

#

but you should hopefully be able to do pipenv command directly now, instead of adding python -m

#

Which should also fix the linting issue

rapid swallow
#

do windows users need to use pipenv-win or something?

#

nvm, I think that's for pyenv

gritty wind
#

I'm using pipenv fine, but his problem seems to be not having it installed on sys

rapid swallow
#

yeah

#

but if pipenv is not in path, they might have some other underlying issue

balmy sparrow
#

says requirement already satisfied

rapid swallow
#

I think you are installing pipenv to the virtual environment

gritty wind
#

Ok i'm a bit out of ideas now, but you can try adding to path ig

tawdry vapor
#

The simple fix is to just add the user scripts directory to PATH... It doesn't matter if it's installed to the global site, the user site, or your desktop. Just add it to PATH and it would've fixed the issue.

rapid swallow
#

and not as a global package

gritty wind
rapid swallow
gritty wind
#

Not necessarily, but it's using his actual pip, so not a virtual env

balmy sparrow
#

Editing environment variables should take effect immedietely right?

gritty wind
#

After restarting the terminal, yeah

#

(restart as in close and open)

balmy sparrow
#

Oh right lmao

balmy sparrow
patent pivot
#

Actually, cc @hardy gorge, you mentioned we could replace the GitHub label bot with GitHub Actions, is that possible?

#

and if so, where do we start

hardy gorge
#

It should be, depending on the kind of labels you want

patent pivot
#

same as we had before, needs 2 reviews, needs 1 review, waiting for author

hardy gorge
#

Shouldn't be too difficult, although I've had a few glitches before. I'll write something tomorrow or so.

gritty wind
#

Hey, is rijusougata13 on github here?

#

Or aruna2019, I'm unclear which one it is

quiet gull
#

yes

#

i am here

green oriole
#

Hey

#

Well, I think the PR is good to go

quiet gull
#

will it be merged then?

green oriole
#

I think so, I am going to leave an approval and ask someone to squash the commits

quiet gull
#

do i have to create a new pr because it was disapproved and didnt passed the cases.

green oriole
#

No no, you are all good

#

The check didn't pass because I asked for change

quiet gull
#

ok thank you for helping me in this

green oriole
#

Sure thing

#

!pep8

stable mountainBOT
#

PEP 8 is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide.

You can find the PEP 8 document here.

quiet gull
#

sure i will check it out

green oriole
#

Thank you

#

@gritty wind do you mind re-reviewing this?

vocal wolf
#

@green oriole lol I'll review this

#

also squash/merging is apparently not enabled in sir-lancebot

gritty wind
#

Hey @quiet gull it isn't mandatory, but have you considered adding this part too?

Additionally, you can add a try/except around the input section, to report invalid input and stop the bot from failing the game.```
quiet gull
#

@gritty wind can i do this like-

#

try:
return grid[number-1][index]
except:
return "invalid input"

gritty wind
#

Preferably you'd wrap it around the entire code that could generate an error, which is pretty much the whole function.

If you put it around line 262, you can wrap the whole function. Also, shouldn't be there, you should send a message to the player (you can see an example on line 247 and 248).

#

You can also see how to structure your try/except/else in that code block so you can ask for input again if the input is invalid

gritty wind
#

If you're not interested in implementing this suggestion, feel free to say so and we'll get your contribution merged ๐Ÿ˜„

tawdry vapor
#
cold island
short snow
#

should i ask them, which tokens would they want?

#

like react to ๐ŸŸ  ๐Ÿ”ต ๐ŸŸข ๐Ÿ”ด ๐ŸŸก etc.?

gritty wind
gritty wind
short snow
#

also, i didn't understand your last review comment

gritty wind
#

The one about returning?

short snow
#

If you return at this point, you can simplify a large portion of this function. You'd be able to remove all the code that checks for a full column, and all the code that tries to break out of the loop, and the return at the end.

#

this one

gritty wind
#

Use your better judgment here, I don't think its necessary, but if you want to do it, go for it

short snow
#

nvm, would just leave that out

#

and how about using ducks instead of the tokens

gritty wind
#
         for row_num, square in reversed(list(enumerate(column))):
                    if not square:
                        self.grid[row_num][column_num] = player_num
                        coords = row_num, column_num
                        break
                else:
                    await self.channel.send(f"Column {column_num + 1} is full. Try again")
                    full_column = True
            if not full_column:
                break
        return coords
short snow
#

ducky_wizard andducky_lemon

gritty wind
#

So here is what I'm thinking

#

There are only 2 things that happen here, you either return coords, or you loop in the while loop again

#

These four lines

full_column = True
            if not full_column:
                break
        return coords

Are not really necessary

#

(As well as the break)

#

You can cut it down to:

         for row_num, square in reversed(list(enumerate(column))):
             if not square:
                 self.grid[row_num][column_num] = player_num
                 return row_num, column_num
         await self.channel.send(f"Column {column_num + 1} is full. Try again")
gritty wind
short snow
#

ok

#

pycharm takes ages to load, so wait for sometime

gritty wind
#

Take your time lol

gritty wind
#

I think that works, but maybe should be optional

#

It can be part of the command

short snow
#

theme?

gritty wind
#

You can call it that

short snow
#

fruits - ๐Ÿฅ’ ๐Ÿ‰

lemons - lemon_s_autumn lemon_s_winter

ducks - ducky_wizard ducky_lemon

python - pydis_hacktoberfest_2020 python

gritty wind
#

What if you just take two optional emojis in the command?

#

That way you can pick your tokens, without adding any time to the game

short snow
#

what they put nsfw emjois? or emojis that the opponent won't like?

gritty wind
#

On the second part, that one feels a bit irrelevant, as the token isn't too big a deal, and if it bothers you that much, you just don't join the game

#

On the first part, can't the bot only send default emojis, and emojis from this server anyways?

short snow
#

hmm yeah

#

๐Ÿ–• what about this?

gritty wind
#

If someone wants to be childish, let them

gritty wind
short snow
#

lol ok

#

should board come before or emojis?

#

in the arguments order

gritty wind
#

board size then emojis

#

I think it's easier to enter a number to get to the emojis, than it is to enter two emojis to get to a number

short snow
#

ok

short snow
gritty wind
#

Yup, we don't want non-server emojis anyways

#

First check if the bot has access to the emoji

short snow
gritty wind
#

And if doesn't send an error

short snow
#

ok, how is that done?

#

lemme look up the docs one min

short snow
#

you were too fast, ty

gritty wind
#

lol no worries, always feel free to ask

#

For whomever merges lance#564, make sure to squash the commits

gritty wind
#

@tawdry vapor I'm looking over 1346. In terms of the channel getting closed at the same time as the dormant close, we were discussing the possibility of making the bot not close the channel if it detects typing (in #community-meta).

Would that be an alternative solution, and if so, wouldn't it be a simpler implementation?

tawdry vapor
#

No it just leads to a bigger 3-way race condition

#

The close task will be scheduled regardless so the typing event would be racing to cancel it

gritty wind
#

Right, but you don't have to cancel the scheduled event, you can add the check in the close function, and reschedule if it needs to

tawdry vapor
#

That still has the exact same race conditions currently present

gritty wind
#

Fair enough then

short snow
#

@gritty wind changes pushed

#

and changes mentioned

#

also, we could link them in the footer (The open trivia db)

gritty wind
#

Don't worry about those for now, its just a reference for later. I personally don't understand much about licencing myself so

short snow
#

aight!

short snow
#

to open issues on features, are we supposed to tell them here, or we can directly open issues?

#

or to make some commands, more better

patent pivot
#

feel free to open issues, it's nice to discusss on github

short snow
#

ok.

#

was thinking of:

  • displaying summary of the options of wikipedia command.
  • hangman game.
gritty wind
#

Those would be two separate issues, correct?

short snow
#

yeah

gritty wind
#

What are the options for the wikipedia command?

short snow
gritty wind
#

.wiki python

dusky shoreBOT
#

Enter number to choose

short snow
#

these options

#

1-9

gritty wind
#

Oh like the results

dusky shoreBOT
#

Sorry, but you cannot do that, I will only accept an positive integer, You have 2/3 chances left

short snow
#

using paginator

gritty wind
#

Okay, go for it

dusky shoreBOT
#

Sorry, but you cannot do that, I will only accept an positive integer, You have 1/3 chances left

gritty wind
#

how do I exit this

dusky shoreBOT
#

Sorry, but you cannot do that, I will only accept an positive integer, Please try again by using .wiki command

gritty wind
#

ok its done

short snow
#

and bump

#

lol

cold island
gritty wind
#

Is it installed in your pipenv?

#
  • pipenv run pip list
cold island
#

Well it's the bot env

gritty wind
#

Hmm it should be available when run then

cold island
#

I tried installing the precommit hook

gritty wind
#

can you try manually running it pipenv run pre-commit

#

or is it pipenv run python -m pre-commit

#

one of those

cold island
#

that is the command I used

brazen charm
#

The first thing that came to mind was an unactivated env but the first line looks like it is; did you install the dev dependencies?

cold island
#

I ran pipenv install

brazen charm
#

I believe it only does normal packages by default, try sync/install with --dev

gritty wind
cold island
#

Ok, that worked. Thanks! @brazen charm @gritty wind

rose heron
#

๐Ÿ‡ญ how can my bot react with this. stuck at emojies again

#

got em nvm

obsidian patio
trim cradle
#

Please review the #rules, especially 3 and 7, which pertain to following staff instructions and keeping channels on their respective topics. Thanks!

surreal venture
#

Can anyone give a PR review for any pull request?

cold island
#

yes

surreal venture
#

Okay

short snow
#

@eternal owl sure, will do that on the wikipedia, on mobile so no login to github.

eternal owl
#

๐Ÿ‘

short snow
#

is there a issue open on the formating of the reddit webhook already?

subtle kraken
#

whats wrong with the formatting ?

short snow
#

the one with Im_joesph and it breaks the formatting of the others then

green oriole
#

Damn @brazen charm that was fast haha

#

I should have marked the PR as draft

#

We are looking into the size issue

brazen charm
#

There is an issue for unescaped brackets in the post bodies, but solving that probably isn't going to be exactly trivial unless every link in them is escaped (and broken)

short snow
#

hmmm k

brazen charm
#

Normal styling Markdown should be simpler but it'll still need to handle escaped markdown etc. if it's done properly

brazen charm
patent pivot
#

yeppers

#

review from yourself and scale is good enough for me

brazen charm
#

Thanks

gritty wind
#

When was the JSON check removed from pre-commit?

short snow
#

@Scaleios#8200 yeah even i did that, but if we keep the difficulty level to medium, then the questions which come out are relatively good

(sorry for ghost ping in media)

#

(for open trivia db)

late wolf
#

Why no ping command for @dusky shore ?

patent pivot
#

what's the purpose of it?

#

we have ping on @stable mountain to do a rough infra check, and even then most of our infra monitoring is done through other tools

late wolf
#

infra check?

#

You use ping to do infraction check?

patent pivot
#

infrastructure

short snow
#

how about putting Loading... message before .spookify and such commands since they take time, and when they are done, the msg are just edited

patent pivot
#

!ping

stable mountainBOT
#
Pong!
Command processing time

88.663 ms

Python Discord website latency

1.183 ms

Discord API latency

116.843 ms

short snow
#

so atleast the user knows about that

cold moon
#

@dusky shore Starts typing

patent pivot
#

wew ks is too fast

short snow
#

but, sometimes it stops too

#

like it just happened for ks123's

late wolf
#

It didn't stop for me

#

ยฏ_(ใƒ„)_/ยฏ

cold moon
#

Yes, this takes very long time to generate images

short snow
#

sometimes

vale ibex
#

I've been looking at constants.py in sir lancebot and am wondering, what are the benefits from inheriting from NamedTuple?

#

Is it to make the class immutable?

late wolf
#

Its the same as collections.namedtuple

hardy gorge
#

It's a pretty common practice for something like that

#

You also have typed dicts in the typing module

vale ibex
#

Makes sense, thanks ๐Ÿ™‚

green oriole
#

Hey @pulsar salmon!

#

Our current setup should be working without any issue but here is the issue

#

We currently have around 27k infractions in our database, and if we try to search for something like " ", it will try to send back 15k or so infractions, and it won't work

#

Well, it would technically work but it will run into physical limitations first

#

So we need to make sure that we won't send more than 50 infraction back

#

If you want to test this, you can create 6 dummy infractions and try to limit the query to 5 infractions, and test that

pulsar salmon
#

Thanks @green oriole I will try doing that.

short snow
#

@gritty wind since the discord emoji check doesn't work for default emojis, i would need to implement it on my own which is a 4000 character regex

#

so should i still do the part or skip it?

gritty wind
#

The easier solution would just be to union it to discord.emoji, and one letter strings

#

Since that's what all emojis will fall into

#

If it's > 1 character, you can fail the conversion, and if it is 1 character, but like a letter or whatever, it isn't a big deal

#

(I'm also seeing a bunch of much shorter regexs, but this isn't such a crucial feature to warrant getting into that)

short snow
#

hmmm, lemme try that

#

didn't think of that

short snow
#

@gritty wind code pushed, the earlier one had problems in the emoji check

tawdry vapor
short snow
short snow
#

should we add this to http_cat?

#

like:

#
.http cat <error_code>
.http dog <error_code>
#

bump.

cold moon
#

Dogs lemon_hyperpleased I'd really like to see .http dog command.

short snow
#

the problem it is not included in python library, so we can use aiohttp and a regex to get them all

cold moon
short snow
#

am checking for available ones

#

like when it is not available we say, that wrong statuscode

#

.http_cat 999

#

#bot-commands message for this

#

we check in the list of correct ones right?

cold moon
#

.source http_cat

dusky shoreBOT
#
Command: http_cat

Sends an embed with an image of a cat, potraying the status code.

Source Code
cold moon
#

We can use same strategy

short snow
#

so similar, we would need to create our one list usng aiohttp, to get the codes

#

there are different from the cat ones

#

some are missing ig

#

should i open a issue on it?

#

or just make a pr

cold moon
#

Sir Lancebot contributing guidelines requires issue

clever wraith
#

@daring peak

#

hi

daring peak
#

this is not where I meant

#

I mean help channel

clever wraith
#

oh

daring peak
eternal owl
patent pivot
#

Hmmmm

#

Potentially not, since were splitting out the features that need subdomains into different apps

#

staff subdomain => logcord
api subdomain => separated API

gritty wind
#

What about the new apps using sub domains? Forms for instance

#

Iโ€™m not aware of any using the siteโ€™s auth though

patent pivot
#

we use a tonne of subdomains internally which are fine

#

because that's chaos

#

especially for local dev setups

short snow
#

weird all my cogs get loaded but the bot is offline

#

zeero errors

#

nah was my net problems

short snow
gritty wind
#

What are you doing when itโ€™s raised?

short snow
#

nvm, found it, was using the for loop variable instead of the list to which the results were appended

short snow
#

Scaleios can u have a look at my pr when u are free of c4

gritty wind
#

Yeah, Iโ€™m planning to get on that soon

daring peak
#

hello fellow pythonistas

#

please check it out yourself and see

#

should I open an issue in github? or wait until a response is given to the above messages?

gritty wind
#

Its in the halloween cog, so I'm assuming it just isn't loaded right now

balmy sparrow
gritty wind
#

Hmm, that's true

#

I can't test if there's anything broken with it because I don't have an API key, perhaps someone in devops can check sentry

daring peak
cold island
#

the halloween cog only executes commands in October iirc

gritty wind
#

That's what I thought at first, but the cog is loaded, and there don't appear to be any seasonal checks in the scarymovie file

cold island
#

hmm ok so it's just the reactions that are limited to October

#

we don't seem to do logging for lancebot, so it'll have to be debugged

eternal owl
#

@gritty wind regarding the quiz questions, do you think it will be a good idea to use Open Trivia DB ?

gritty wind
pulsar salmon
#

Hey, does anyone know how to implement LimitOffsetPagination to limit the number of queries returned? I am a beginner and trying to contribute to resolve an issue. I feel like I should use the paginate_queryset method but I am feeling abit confused navigating through the viewset code. Any advice/ suggestion will be great. Thanks

sharp timber
#

On GenericAPIView subclasses you may also set the pagination_class attribute to select LimitOffsetPagination on a per-view basis.
seems relevant from a cursory look

late wolf
#

For the internal cog, self.interpreter is not being used, so why is it there?

exotic ember
#

most likely a missed line during a refactor

late wolf
#

why do we even have helper interpreter?

exotic ember
#

not sure what you mean by that?

exotic ember
#

we probably aren't

late wolf
#

then why does it exist lol

exotic ember
#

well, we probably were using it, then did a refactor that removed the need for it, but didn't get rid of it

#

dead code so to speak

late wolf
#

can I open pr removing it?

exotic ember
#

sure

short snow
#

till when does a issue get approved/rejected?

brazen charm
#

It'd probably be worth looking at making int e use it, the cog is a bit of a mess and abstracting the run logic away would help

gritty wind
short snow
#

ok

#

had about porting commandnotfound suggestions, status dogs, and improving wiki command

gritty wind
#

If they both have issues open, they will be dealt with sooner or later
(cc @vocal wolf as our resident triager :D)

vocal wolf
#

Sorry, I've been really busy lately, I'm getting around to issues/PRs though.

gritty wind
#

Lol it wasn't a dig, those are pretty recent issues

vocal wolf
#

I've been focusing on reviving really old issues/PRs

#

working backwards lol

#

I'll check out the recent ones tho

short snow
#

ok np.

short snow
#

@vocal wolf there is a typo in the dog status issue. it is
Since dogs have some codes missing, we will use
and not
Since dogs have some comes missing, we will use, will fix that

vocal wolf
short snow
#

does anyone have the regex for getting the message inside a single/block codeblock

#

need for the automatic linking issue on sir-lancebot

exotic ember
#

!source snekbox

stable mountainBOT
#
Bad argument

Unable to convert 'snekbox' to valid command, tag, or Cog.

#
Command Help

!source [source_item]
Can also use: src

Display information and a GitHub link to the source code of a command, tag, or cog.

exotic ember
#

is it not called that anymore? Anyways the source for !eval should have something like that

patent pivot
#

!source eval

stable mountainBOT
#
Command: eval

Run Python code and get the results.

Source Code
patent pivot
#

or do you mean linking to the snekbox repo

exotic ember
#

I wanted to link to the snekbox cog

#

thought that was possible

subtle kraken
#

!src Snekbox

stable mountainBOT
#
Cog: Snekbox

Safe evaluation of Python code using Snekbox.

Source Code
subtle kraken
#

@exotic ember

#

case sensitive

exotic ember
#

ah

vocal wolf
#

In need of reviews

vocal wolf
#

Another one in need of reviewing:

rapid swallow
vocal wolf
#

No.

rapid swallow
#

no, like, it would be a cool feature

#

so can you try to implement it?

vocal wolf
#

Well yes, it would. But it's not actually possible.

rapid swallow
#

yeah...

vocal wolf
#

Without like recording the names and their respective numbers

rapid swallow
#

since no one even knows the real name of the strips

vale ibex
#

yea, we'd need to store a reference to each comic to allow that, since xkcd haven't implemented a search

rapid swallow
#

We might be able to get that information from some website

vale ibex
#

Also, I'm not sure if XKCD titles are unique?

vocal wolf
#

I think it would be just easier to go by number. That's what we usually reference them by.

rapid swallow
vale ibex
#

which might be cool to implement

#

So rather than a title, it takes a concept

vocal wolf
vale ibex
#

oh yea for sure

rapid swallow
vocal wolf
#

@rapid swallow If they do implement a search feature, I'll be sure to put that into the bot.

rapid swallow
#

alright ๐Ÿ‘

vocal wolf
#

@vale ibex If you don't mind, you can re-review and hit approve

late wolf
#

the current server command only shows online and offline members but this
https://github.com/python-discord/bot/pull/1166 pr, shows all online, idle, offline and dnd.
Do we really want to show all of those instead of showing only online and offline?

vocal wolf
#

!server

stable mountainBOT
#

Server information
Created: 4 years and 16 days ago
Voice region: europe
Features: BANNER, COMMUNITY, DISCOVERABLE, PARTNERED, VIP_REGIONS, WELCOME_SCREEN_ENABLED, VANITY_URL, MEMBER_VERIFICATION_GATE_ENABLED, PREVIEW_ENABLED, INVITE_SPLASH, ANIMATED_ICON, RELAY_ENABLED, NEWS

Channel counts
Category channels: 26
News channels: 8
Text channels: 154
Voice channels: 15
Staff channels: 61

Member counts
Members: 136,870
Staff members: 88
Roles: 86

Member statuses
status_online 32,583
status_offline 104,290

brazen charm
#

The screenshots are outdated

vocal wolf
#

here's where the command is currently at

late wolf
#

right

vocal wolf
#

@vale ibex ty โค๏ธ

rapid swallow
#

I could nitpick

#

but uhhh

vocal wolf
#

Another PR that needs reviewing

eternal owl
#

I will take a look

cold moon
#

What discussion is going on in dev-voice currently?

vocal wolf
eternal owl
#

keyboard silence Derp_Slamming_Keyboard

#

do we want another reaction to cancel the game(call it a draw) before the game actually ends?

#

if it is User vs AI, then only the user needs to react, if it is User vs User, both of them have to react

#

@cold moon

cold moon
eternal owl
#

yea, I think 120s is kinda too long? its not a game where we would spend that long to think lemon_pleased ?

cold moon
#

Maybe then 60s?

eternal owl
#

yea

#

even 30s should do I think

cold moon
#

I make change now

eternal owl
#

oki

#

I will make a comment just to keep track

cold moon
#

Change made

eternal owl
#

I haven't tested this with a second player tho

#

lemme do a quick test with a friend

late wolf
#

What yall dicussing?

vocal wolf
#

currently keyboards are being slapped

#

mostly silence

eternal owl
#

approved @cold moon ๐Ÿ‘

vocal wolf
#

@cold moon anything else to commit? If not, we can merge.

vocal wolf
#

alright

short snow
#

Should there be ability to choose your tokens on the ttt command.

#

In dev-voice we canโ€™t join but in media we can, hmmm

#

Y so?

eternal owl
#

they are treated as player 1

eternal owl
#

the ppl with the contributors role

late wolf
late wolf
#

Hey why aren't we able to exit out of .ttt?

green oriole
#

What do you mean? Cancel the game?

late wolf
#

No cancel the game

gritty wind
green oriole
#

Hmm

#

Why not

eternal owl
#

I can make an issue if you are interested on working on it

#

@late wolf

hallow venture
#

Hey

signal hedge
#

`@client.event
async def on_member_join(member):
await client.get_channel('#795719602691637319').send(f"{member.name} has joined")

@client.event
async def on_member_remove(member):
await client.get_channel(795719602691637319).send(f"{member.name} has left")
`

#

can i use this

#

for simple welcome message

#

?

gritty wind
#

This channel is for pythondiscord projects

signal hedge
#

oke

short snow
late wolf
# eternal owl <@!707472976454483988>

Until vsc decides to co-operate and change the goddamn font, i can't work on anything.
So, I can work on it when vsc decides to co-operate if someone else hasn't already.

late wolf
#

Hey, can I get the table creation query for the infraction table?

eternal owl
late wolf
#

thankyou

#

but i was asking for the table structure

eternal owl
#

you can make out from the django model, right?

eternal owl
eternal owl
late wolf
late wolf
eternal owl
#

just reinstall vscode and delete all the prev configs

late wolf
late wolf
#

Hey i never requested review from @ks123#9814 but why did github automatically do that?

gritty wind
#

Codeowners

#

He was a codeowner of a file you edited, so it requested him

late wolf
#

ooh

#

oh forgot to remove the import

gritty wind
#
-- auto-generated definition
create table api_infraction
(
    id          serial                   not null
        constraint api_infraction_pkey
            primary key,
    inserted_at timestamp with time zone not null,
    expires_at  timestamp with time zone,
    active      boolean                  not null,
    type        varchar(9)               not null,
    reason      text,
    hidden      boolean                  not null,
    actor_id    bigint                   not null
        constraint api_infraction_actor_id_ed96dde9_fk_api_user_id
            references api_user
            deferrable initially deferred,
    user_id     bigint                   not null
        constraint api_infraction_user_id_8714e9f5_fk_api_user_id
            references api_user
            deferrable initially deferred
);

alter table api_infraction
    owner to pysite;

create index api_infraction_actor_id_ed96dde9
    on api_infraction (actor_id);

create index api_infraction_user_id_8714e9f5
    on api_infraction (user_id);

create unique index unique_active_infraction_per_type_per_user
    on api_infraction (user_id, type)
    where (active = true);```
late wolf
#

thx

#

you should have pinged me on that

short snow
#

still left to go through the full pr m_cht, but yeah did some part of it.

late wolf
#

So before when we did !help tempban we didn't get a response back, but rn we do.
Why was this changed?

subtle kraken
#

iirc previously if you couldn't run a command, it simply wouldn't give you help
now that info is in the help embed (that you can't run the command)

#

it is how help system works in d.py as well, if you can't run a command chances are you don't need to know it exists

cold island
#

That's how it was before, then it just didn't give the help embed, and now it's back to the previous behavior

short snow
late wolf
green oriole
#

Right, I think it is because it is part of the site module, which isnโ€™t loaded by snekbox

#

!e

import site
site.main()

help(list.append)```
stable mountainBOT
#

@green oriole :white_check_mark: Your eval job has completed with return code 0.

001 | Help on method_descriptor:
002 | 
003 | append(self, object, /)
004 |     Append object to the end of the list.
green oriole
#

There you go

late wolf
#

oooh so we need to add site to snekbox allowed packages??

green oriole
#

We use the -S option to not load it, so I assume that thereโ€™s a reason for us to not load it

balmy sparrow
#

@exotic ember has requested changes on https://github.com/python-discord/bot/pull/1372 , but the ensuing discussion seems to suggest that I don't have to be making any changes. Should I be doing something? Or have I misunderstood it, and I need to be making changes?

exotic ember
#

@balmy sparrow I misread the function, your PR is fine. Give me a bit and I'll get it merged

balmy sparrow
#

Cool, thanks :D

late wolf
green oriole
#

Merged!

late wolf
#

Thx

late wolf
#

What exactly is Sentry in terms of @stable mountains code?

cold moon
#

Sentry is errors catching service

green oriole
late wolf
#

thx, leme check it out

patent pivot
#

good service

late wolf
#

For our redirect_output decorater why do we not use commands.check() but make it accept the function?

late wolf
#

Also, why do bot about rather than just about?
The goup has only command, why use group if we are only gonna have one command?

short snow
#

and bot doesn't show up in the help command, why?

subtle kraken
#

both of those commands are hidden
might be why

short snow
#

but why can we use them then?

subtle kraken
#

hidden != usable

green oriole
#

They are pretty useless tbh

subtle kraken
#

to be fair, I haven't heard of bot group before

#

I think its a subject to be deleted

green oriole
#

We could add some informations here

#

But I would happily nuke it

late wolf
late wolf
subtle kraken
#

as I just said, I haven't even known of their existence so its hard for me to tell

late wolf
#

or just make it about

subtle kraken
#

group is subcommand system

subtle kraken
late wolf
subtle kraken
#

theres no difference

#

there is only one subcommand system in d.py

#

which is group

#

subcommand decorator means its a subcommand of group

#

group means its parent command and group of commands

late wolf
#

oh right

#

i was hallucinating

subtle kraken
#

group is bot subcommand is about

exotic ember
#

@balmy sparrow while testing I found another potential issue, sorry for the false promise of a quick merge lemon_pensive

late wolf
#

my b

balmy sparrow
late wolf
#

Can I open a pr, making the about command not hidden and not making it a group

brazen charm
#

I think should be discussed more in depth in an issue first, it's probably not necessary at all; I doubt it had a significant amount of uses recently

late wolf
#

k

gritty wind
#

You could open it, but if weโ€™re discussing removing it entirely, it probably wonโ€™t be approved for a while, if at all

#

Iโ€™m on mobile, so I canโ€™t search it atm

#

What cog is it?

late wolf
#

!src Utils

stable mountainBOT
#
Cog: Utils

A selection of utilities which don't have a clear category.

Source Code
late wolf
clever wraith
#

Hey Guys , so i managed to run the docker

#

And the image is also running now

#
2021-01-25 14:17:18,964 |     9 |                 gunicorn.error |     INFO | Booting worker with pid: 9
#

Now what to do , i mean where is the snekbox code

gritty wind
gritty wind
clever wraith
#

it is running on http

gritty wind
#

Wait if you started the docker compose of the bot, you should be able to interface with snekbox directly or through the bot

clever wraith
#

This

gritty wind
#

Ok, so what do you need to do now?

clever wraith
gritty wind
#

Yeah, but youโ€™d need to add a bot to load it and run

#

And if it has imports from the rest of the project, youโ€™d need those too

clever wraith
#

Ik discord.py , but the python bot code is so dependant

#

on other files

gritty wind
#

The whitelist and channel stuff is needed, but it can be ripped out

#

Let me try to highlight the necessary parts

clever wraith
#

Ohh kk , thnx in advance ๐Ÿ™‚

gritty wind
#

Youโ€™d need all the imports on lines 1 - 9 (12 if you want to reuse the discord components). 22-39 are input parsing so youโ€™d need those too unless you want to write your own. 46-49. Youโ€™d want most of the class itself, but you should remove line 283 (maybe even 282), and you should set the URL of snekbox on line 61. You can keep everything after the class too

#

This is only the cog though, youโ€™d need something to start the bot itself

late wolf
#

Happen to ping me if you guys reach to a conclusion on what to do with the bot about command

green oriole
subtle kraken
#

!src

stable mountainBOT
subtle kraken
#

duplicate of ^

green oriole
#

Yeah

late wolf
wintry trellis
gritty wind
#

Docker i not mandatory for any of the projects

#

That being said, it does make certain aspects easier

#

Like the databases, the site, snekbox, etc

#

But you can run everything on your host

brazen charm
#

The bot is probably the project where it helps the least, but the site can be a pain to set up without docker depending on the os

green oriole
#

I would honestly recommend you to use Docker for all of our projects, at least when possible

wintry trellis
#

๐Ÿ‘

wintry trellis
#

Nice to meet you once again!
With reference to https://pythondiscord.com/pages/contributing/bot/#environment-variables, is it fine if we use only the BOT_TOKEN and BOT_API_KEY variables?
If so .env file will become:

BOT_TOKEN=token
BOT_API_KEY=key

Also, how to acquire the BOT_API_KEY?

cold island
wintry trellis
#

I see, thank you.

cold island
#

that is assuming you're running the bot using docker

wintry trellis
#

For now, I am running it locally

#

I assume I need to use all the variables then?

#

And that might be the reason for the cause of this error?

from async_rediscache import RedisSession
ModuleNotFoundError: No module named 'async_rediscache'
cold island
#

looks like you just don't have the package installed.

What is your reason for starting up the bot?

sharp timber
#

Oh this, I had this issue

#

There's something wrong in the dependency install step, I think, in the docs, because I got around this I believe by disabling the included redis setup. That, or there's something I missed, which is very likely

green oriole
#

Hmmm

#

Do you use Docker ?

sharp timber
#

I was

#

docker-compose up was throwing this

green oriole
#

Hmm

sharp timber
#

I can restart into my linux if you're free to help troubleshoot?

green oriole
#

Sure thing

sharp timber
#

kk, here goes nothing

#

alright, syncing up my system and its a slight bit of a mess so ~10m

sharp timber
#

resetting back to the original state

#

just isntalled updates, so gonna reboot, see if I can force upgrade my python to 3.9 and try again

#

python's at 3.9 now so the reboot changed osmething, but still broken on libffi, so forcing a reinstall via pyenv

#

Well, this sucks

#

Why does pip install --upgrade pipenv leave me at pipenv 2018.*.* pithink

#

conflicting pipenv versions, fixing

#

Ok, I had to manually purge a version fo pipenv I don't know how got on my system >.> but its settup up now

#

Fighting virtualenv again ;-;

#

Why does it keep calling into python 3.8. My python 3.8 doesn't work.

#

Ok, after manually navigating into ~/.local and purging the broken virtual environments it seems to be working

#

reinstalling dependencies with pipenv sync --dev

#

Alright, I'm not getting the async redis error anymore for the moment, but I am throwing a "Connect call failed: cannot assign requested address" @green oriole if you have some insight here

#

I threw up a use_fakeredis last time I used this to get around it, but that feels wrong

cold island
#

Are you talking about the bot or lancebot?

sharp timber
#

bot

cold island
#

Also the bot uses 3.8 iirc

sharp timber
#

My 3.8 is broken, so I bumped the pipfile up to 3.9. Was getting this error before all that happened, so I don't think it's related

#

Why on earth is it still using 3.8 for the bot if I changed that

cold island
#

Might be related to your config file

sharp timber
#

I just realized the docker container is firing up with 3.8

#

that probably isn't related though

cold island
#

Yeah it's probably fine

sharp timber
#

The 3.8 error is a ctypes .so error and this is just a binding error

cold island
#

What is your config under the URLs section

sharp timber
#

Should be basically the default

#

web:8000, etc

#

The erroring bind is defined at the top, 6379, for redis

#

host localhost

cold island
#

If you're using docker then the only variable I can think of is the config. Maybe try copying the version on Notion

sharp timber
#

Where under notion would it be?

#

found it

#

Home expands, that was not obvious

#

ah, so the config has fakeredis on

#

ModuleNotFoundError: No module named 'arrow'

cold island
#

Try rebuilding the image?

#

Pull first

sharp timber
#

how do I force it to

cold island
#

docker-compose pull

#

docker-compose up --build

sharp timber
#

TIL

#

And that will probably fix it

#

errored on api.localhost, which makes sense, let me reset that part of my config

#

Ugh, what did I do to fix that

#

but it's no longer breaking on redis or arrow, which is good, thanks

green oriole
#

Youโ€™ll have to start the site before the bot

#

The bot will start faster than the site, and error out

cold island
#

Hm? Why? It should start both

green oriole
#

try dcoker-compose up -d web and docker-compose up --build bot

green oriole
#

I opened an issue about that

sharp timber
#

Doesn't apply here, I'm getting a dns error despite starting the site manually first

cold island
green oriole
#

Hmm

sharp timber
#

cant connect to api.localhost:8000 basically

green oriole
#

You are starting the site using GHRC container, right?

sharp timber
#

docker-compose up web

green oriole
#

hmm

#

They should use the same virtual network

#

Are your git repo up to date?

sharp timber
#

Should be

#

I just did a git pull upstream master git push origin master

green oriole
#

Hmm

#

Oooh

#

Got it, you are using localhost

sharp timber
#

I'm on 134a2c61...

green oriole
#

This works if the site is running on the host

#

Otherwise you should use web

sharp timber
#

I changed the site: &domain to web:8000, but it continued to error

#

OK, this time it didn't

#

I changed nothing but now its failing with "improper token" and I at least know probably what that error is

green oriole
#

Cool

sharp timber
#

I mistakenly erased my .env file, so time to fix that sigh

#

TIL if your window is too small there's no indicator that your token is cut off

#

alright, came up just fine

wintry trellis
#

I installed the package async-rediscache

wintry trellis
#

Not sure where I am going wrong.

short snow
#

@green oriole "The Automatically linking issues using repo#number in messages" pr is ready for review.

green oriole
#

Saw that, thanks!

short snow
#

one more question, for testing prs, like currently am testing iceman's, do we just copy paste their code into ours like on a branch called testing or something, and then test it.
or ...?

brazen charm
#

checkout their branch

short snow
#

what if it is not the main repo?

brazen charm
#

I use this git alias from Mark to do it quickly cpr = "!cd ${GIT_PREFIX:-.} && git fetch upstream refs/pull/${1}/head && git checkout FETCH_HEAD #", to do it manually you just have to fetch the pull head and checkout

short snow
#

ok thankyou!

#

can override_in_channel decorator be used for on_message listner?

vocal wolf
#

I just use github's CLI

#

gh pr checkout 567

short snow
short snow
#

#bot-commands message the inline coceblock check fails here (from bot/filters)

gritty wind
brazen charm
#

The bot package has to be ran as a module if you're not doing that

short snow
#

python3 -m bot or pipenv run start โคด๏ธ

cold island
#

And there should be no reason to change the code just to make it work - it should already work as is.

gritty wind
#

They were repurposing the snekbox code for their own bot

gritty wind
cold island
#

Well, then you don't need all of the code and dependencies, just the eval cog.

green oriole
#

!source eval

stable mountainBOT
#
Command: eval

Run Python code and get the results.

Source Code
green oriole
#

You only need to use this file, although youโ€™ll have to change some contants and things like that.

gritty wind
#

Theyโ€™ve had that since yesterday, but they were struggling to decouple it from the bot

short snow
#

ig they are writing their own snekbox instead

short snow
trim cradle
#

Can someone send me their bot config file for the bot test server? I lost anything that wasn't checked in when I wiped my computer.

late wolf
#

What's wrong with the docs command
#bot-commands message

#

it isn't doing anything

wintry trellis
cold island
#

A question. I'm looking at the bot's code, and I see quite a few cogs with class attributes, but they are only used in the context of self. Is there any reason why they can't be instance attributes initialized in init?

#

It's not like we ever have two instances of the same cog

green oriole
#

Do you have any example?

cold island
#

Pretty much any cog under moderation

#

Defcon, incidents, etc

green oriole
#

I donโ€™t see any class attributes in incidents

#

defcon hasnโ€™t been updated in a while though, and is bound to reach the sun

cold island
#

Well I'm updating it right now lol

wintry trellis
green oriole
#

I had a quick look, and it seems like the only class attributes are redis caches, which need to be class attributes

#

What are you doing to the poor defcon?

green oriole
#

We use the attribute name in order to know their unique name

cold island
cold island
green oriole
#

The redis cache name

#

For example, if you have a cache assigned to Zig.zebra, it guess that it should load the cache of this specific entry

cold island
#

Ok

late wolf
cold island
#

Can you give a github link to the function?

cold island
#

And what is your proposed change?

late wolf
#

I wasn't proposing a change, I was asking why do aren't we using commands.check() but rather take the command function itself

wraith kayak
#

When I type docker-compose up, this error shows:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose\cli\main.py", line 67, in main
  File "compose\cli\main.py", line 123, in perform_command
  File "compose\cli\command.py", line 69, in project_from_options
  File "compose\cli\command.py", line 132, in get_project
  File "compose\cli\docker_client.py", line 43, in get_client
  File "compose\cli\docker_client.py", line 170, in docker_client
  File "site-packages\docker\api\client.py", line 188, in __init__
  File "site-packages\docker\api\client.py", line 213, in _retrieve_server_versi
on
docker.errors.DockerException: Error while fetching server API version: (2, 'Cre
ateFile', 'The system cannot find the file specified.')
[5156] Failed to execute script docker-compose
vale ibex
#

Do you have docker running?

thorny obsidian
#

I've gotten this error several times... every single time it was because I forgot I didn't have docker actually running

vale ibex
#

systemctl status docker to see if it is

#

systemctl start docker to start it if it isn't

#

(assuming linux)

wraith kayak
#

I am on windows cmd

vale ibex
#

yea, that's from when docker-compose isn't able to connect to docker via docker socket

#

Do you have docker desktop installed?

wraith kayak
#

Yep

vale ibex
#

Do you have it running?

wraith kayak
#

No

vale ibex
#

That'll be why ๐Ÿ™‚

wraith kayak
#

Yeah ๐Ÿ˜„

vale ibex
wraith kayak
#

when I do pipenv run start, a new cmd opens but the bot is not running. Why?

#

I double checked the bot token

gritty wind
#

Can you try running another command through pipenv

#

For example

#

pipenv run pip list

wraith kayak
#

This is what I got

Package    Version
---------- -------
pip        20.3.3
setuptools 51.3.3
wheel      0.36.2
gritty wind
#

Did that also open in a new window?

#

Also you may need to run install first

wraith kayak
#

No in the same window

gritty wind
#

The whole opening in a new cmd thing is weird, but the error may be caused by not installing. Try running pipenv install --dev

wraith kayak
#

The result is still negative ๐Ÿ˜ฆ

gritty wind
#

Does anything get printed?

wraith kayak
#

Nothing

gritty wind
#

Ok hmm

#

Try pipenv shell to log into the virtual environment

#

Then try python -m bot

wraith kayak
#

Error:
No module named bot .__main__; 'bot' is a package and cannot be directly executed

gritty wind
#

What directory are you in?

#

Right, and where is the repo?

wraith kayak
#

Inside acer and file named bot

gritty wind
#

Ok go the bot folder

#

Make sure you see Pipfile in that folder

#

(Also make sure to exit your current environment first by typing exit)

wraith kayak
gritty wind
#

Run pipenv install --dev and pipenv run start in that folder

stable mountainBOT
#

:incoming_envelope: :ok_hand: applied mute to @wraith kayak until 2021-01-26 19:16 (9 minutes and 59 seconds) (reason: chars rule: sent 3252 characters in 5s).

gritty wind
#

Hey mods, can we get that lifted

cold island
#

!unmute 728987928591728802

stable mountainBOT
#

:incoming_envelope: :ok_hand: pardoned infraction mute for @wraith kayak.

cold island
#

!paste

stable mountainBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

wraith kayak
#

Ok my bad sorry

gritty wind
#

This error is caused by not having redis running locally

#

You can either run it through docker

#

Or use fakeredis

patent pivot
#

hmmmm

#

we should fix that

#

or at least make it more evident what is going on

gritty wind
#

We could default to fake_redis, and make it an env var :D

patent pivot
#

+1

gritty wind
# gritty wind Or use fakeredis

If you want to do this right now, make a copy of config-default.yml, call it config.yaml, and change use_fakeredis on line 10 to true

wraith kayak
#

True is case sensitive?

gritty wind
#

I don't think so

patent pivot
#

not in yaml, no

wraith kayak
#

Looks like that is solved now but now I get this error

aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.pytho
ndiscord.local:8000 ssl:default [Connect call failed ('127.0.0.1', 8000)]

For reference:

config.yaml

urls:
    # PyDis site vars
    site:        &DOMAIN       "pythondiscord.local:8000"
gritty wind
#

Yup, that's because the site isn't running

#

The easiest way to get all the dependencies running is to use docker

#

(You can manually set everything up, but that would take a bit of time)

#

Do you have docker?

wraith kayak
#

I tried installing in linux but not working successfully so decided to do it manually.

gritty wind
#

Well docker can be a bit of a pain sometimes, though I admit I haven't heard of it not working on linux. Either way, the only other app that needs to be running for the bot to start is site

wraith kayak
#

Let me try to setup docker again on linux and will get back right here. Thanks for helping me ๐Ÿ˜„

wraith kayak
#

The main error when I write this command is:

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

Error:

Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 12, in <module>
    from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 28, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
gritty wind
#

What OS are you on, and what steps have you run so far?

wraith kayak
#

Ubuntu 18.
I am currently in the 3rd step under SET UP THE REPOSITORY

green oriole
#

I had a similar issue, I solved it by used the automatic install

gritty wind
#

I guess another solution would be to check the apt_pkg install

#

So apt install python3-apt

#

might need a sudo or two in there

wraith kayak
#

Oh I successfully installed. ๐Ÿ™‚

#

Now I think set up a path to the bot files and do docker-compose up --no-deps bot?

gritty wind
#

Well the whole reason we went through the trouble of installing docker was so you can use the deps

#

Doesn't make sense to disable them now

#

you should be able to start everything up with docker-compose up

#

You can add -d to detach it from your terminal too

wraith kayak
#

Ok, thanks ๐Ÿ˜„

green oriole
#

You shouldn't use --no-deps actually

#

I should update the guide

gritty wind
#

I think that's mentioned under the bot only section

#

so its fine there

green oriole
#

Hmm I see

spiral orchid
#

Hi, I'm working on Infraction result limit. I'd setup the server and ready to roll, but getting confused regarding db structure, like how to update db with dummy data.

#

tried with admin panel but didn't figure out

gritty wind
#

I would say the easiest way would probably be to hand out actual infractions if you have the bot setup.

If not, the data in the DB is probably not too important, just that you have a few infractions. Are you familiar with SQL and inserting into tables at all?

spiral orchid
#

Not much with SQL

#

Can you explain how to setup the bot

green oriole
#

You can use Django admin to insert them

#

You'll need to add a user first

spiral orchid
#

In the API administration user can't be added

green oriole
#

Hmm really

#

You are using the Admin account?

spiral orchid
gritty wind
green oriole
spiral orchid
gritty wind
#

You left the api part off the url

spiral orchid
green oriole
#

Hmm if you set the Auth header you can do a post request from here

spiral orchid
wraith kayak
#

Successfuly installed docker in linux and is running but now I get the following error :

ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
spiral orchid
#

I think that is it or something else need to be changed

gritty wind
#

If it says offline, sudo service docker start

wraith kayak
#

I just did sudo docker-compose up and looks like it worked

#

But this the output I get at last

System check identified no issues (0 silenced).
web_1       | January 26, 2021 - 21:35:24
web_1       | Django version 3.0.11, using settings 'pydis_site.settings'
web_1       | Starting development server at http://0.0.0.0:8000/
web_1       | Quit the server with CONTROL-C.
```Is it?
gritty wind
#

You're up

wraith kayak
#

but the bot isn't online ๐Ÿฅฒ

gritty wind
#

I'm not sure if this is looking at the full container, or just the site one

#

disconnect your terminal and check the status

wraith kayak
#

It says active running in green

gritty wind
#

For all the containers? Is the bot listed there

#

Oh that's the docker enginer, not the actual containers

#

docker container ls

wraith kayak
#

oh

#
     STATUS              PORTS                      NAMES
e23a19f89b0e        ghcr.io/python-discord/site:latest      "python manage.py ruโ€ฆ"   8 minutes ago       Up About a minute   127.0.0.1:8000->8000/tcp   bot_web_1
b39417e58c7e        postgres:12-alpine                      "docker-entrypoint.sโ€ฆ"   8 minutes ago       Up 2 minutes        5432/tcp                   bot_postgres_1
8589936a46cf        redis:5.0.9                             "docker-entrypoint.sโ€ฆ"   8 minutes ago       Up About a minute   127.0.0.1:6379->6379/tcp   bot_redis_1
0bc29b6c54d4        ghcr.io/python-discord/snekbox:latest   "gunicorn -c config/โ€ฆ"   8 minutes ago       Up 2 minutes        127.0.0.1:8060->8060/tcp   bot_snekbox_1
gritty wind
#

Hmm yeah the bot itself is missing