#voice-chat-text-0
1 messages · Page 49 of 1
So is it ok if i ask for help in this channel to?
awsome
Uhm wel im a total noob when it comes to python
And im trying to run a RCON php script that uses python
RCON = remote control administration tool to manage dedicated gaming servers
haha cool
haha
So this tool uses an old Python 2.7 to function
because the game is CoD4 MW
from 2008
Now when i run the administration python file i get the following error
I googled it and some people say im missing a module?
You need to install dateutil
Yeah probably
Yeah, I've used fastapi and mainly use Flask
the problem is that you use a deprecated version
Yeah but the script doesnt work on higher python versions
So when i tried the get-pip it told me the one wasnt working since it was meant for 3.0 it linked me the 2.7 one
i downloaded the 2.7 pip installer
but then i get the above errors
@somber heath i cant even get pip to work T-T
oh
wait
its high res
3440x1660
but that problem looks like a problem from firewall klote
could be its windows 2016
can you verify if the rules in your firewall?
Windows 2016 everything is closed by default 😛
i have to open ports specificaly
github?
No
Was this for COD?
are we talking call of duty or what
call of duty baby
Ok is there a step by step manual how to install this?
@hearty tulip @signal compass 👋
Nope. I don't see any docs but there are examples
wondering if this works for cod4x
cause its a specific cod mod version
identicle?
oh
Today i will show you how to use Big brother bot (B3) with cod4x server
things you need :-
- Python ( version 2.7 ) http://www.mediafire.com/file/m5drcdneijmmsym/python-2.7.17.amd64.msi/file
- My-SQL ( 32-bit ) http://www.mediafire.com/file/r6eqiog63djs750/MySQL-python-1.2.4b4.win32-py2.7.exe/file
- My-SQL (64-bit) http://www.me...
this is what i am trying to run
Bigbrother 3
it worked in 2020
yup xD
or windows server 2008
Noo
i want to be able to do it my self
@main plover 👋
This project is NO LONGER actively maintained. It is provided 'as is' in its current state!
If you wish to apply as project maintainer please contact B3 development team by opening a
topic on the B3 forums.
x-x
Hi HNY!
haha
wait
--trusted-host
maybe that command will allow me to install get-pip
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)",)': /simple/pip/
Hmm, this is interesting: https://github.com/qdm12/cod4-docker
Rabbit got me thinking someone may have made a docker container for a cod server
@daring needle
hello
what is a docker container?
It's an isolated environment, kind of like a VM but way faster
aah
It's also much safer for running servers on at home
it doesnt run a rcon tho
even if someone breaks into the container, they cannot touch your computer
ah dont worry its a seperate server
running on a empty ssd
if it gets hacked wouldnt matter
i have the server running already all i need is an rcon
but i think i found the solution for the pip issue
I see
im reinstalling python
haha
yeah but im going to need to get pip
to get the module
I download the get-pip.py from https://pip.pypa.io/en/stable/installing/ . Then i changed path in: system-variable environment into : C:\Python27\ArcGIS10.3\Lib\site-packages
after that i tried to...
you mean this?
i found a python2.7 download with pip installer
yes
it was from their website
2.7.18
last release was april 2020
okj
i got pip to work
next error x-x
pip install python-dateutil --upgrade worked
moment of truth
hopefully it works :X
im so anxious
lol
been trying to get this to work for a 3 days
OMG
its working
it dint give any errors
ok starting the server
rip
haha thanks with your advice
hey
quick question
is it possible to use oauth2 to join voice channels
and if yes how should look the request
i tried over the discord api v8 and than guilds guildid channels channelID userID
hi
trying to setup cod4 server that uses a RCON bot running on python
It shouldnt be lol
i am just starting out
but its old stuff
I have no idea even how to put up an interactive website yet
CoD4 = Call of Duty Modern Warfare
aah
yah i dont really play that much either
but i wanted to be able to host stuff
I mixed up ligatures and extreme cases of kerning
like ff
type r and ,
then put cursor between them, it will overlap with r
they get combined while remaining separate symbols
it's not formally a ligature but it uses the same font functionality
it's called kerning not ligature and I forgot that
I just didn't expect it to be that noticeable
@flint terrace 👋
!voice
Voice verification
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
Hahha I have to spek 50 times hahaha
yeahhh
I am working with python 😂 though that I would be adding value to the group
I am a python developer
Wanted to show you some hacks with python
Getting someones info using osnit
ethical hacking
@quick nebula 👋
I have made some cool games and if u have worked with git I could show you something intresting
Sureee
hey Opal!
what are you guys working on rn?
@somber heath
LOL
thats totally fair
well said my man
im messing around wiht ethernaut rn
kinda cool
:/ that sounds tough what field were you in previously./
?
fair
!e ```py
def class_decorator_with_parameters(a):
def d(cls):
class C(cls):
def init(self):
print(a)
super().init()
return C
return d
@class_decorator_with_parameters("Apples.")
class MyClass:
def init(self):
print("Native.")
mc = MyClass()```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | Apples.
002 | Native.
class-related decorators usually do a lot of special attribute access
__special_attribute__
!e
def class_decorator_with_parameters(a):
def d(cls):
class C(cls):
def __init__(self):
print(a)
super().__init__()
return C
return d
@class_decorator_with_parameters("Apples.")
class MyClass:
def __init__(self):
print("Native.")
print(MyClass.__name__)
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
C
it didn't
it created another class
you can overwrite MyClass's __new__
to make MyClass behave like pathlib.Path does
pathlib.Path has custom __new__
and it returns one of its two subclasses
in the thing I'm writing I almost need to call special methods, namely __enter__/__exit__
I can mess with ExitStack but it will only confuse everyone
!d contextlib.ExitStack
class contextlib.ExitStack```
A context manager that is designed to make it easy to programmatically combine other context managers and cleanup functions, especially those that are optional or otherwise driven by input data.
For example, a set of files may easily be handled in a single with statement as follows:
```py
with ExitStack() as stack:
files = [stack.enter_context(open(fname)) for fname in filenames]
# All opened files will automatically be closed at the end of
# the with statement, even if attempts to open files later
# in the list raise an exception
``` The `__enter__()` method returns the [`ExitStack`](https://docs.python.org/3/library/contextlib.html#contextlib.ExitStack "contextlib.ExitStack") instance, and performs no additional operations.
how dose this bot works?
which part of the bot?
just prompting it
I do use ExitStack but for some more complex usecases
!d probably looks up the entry in the documentation index
idk where that index is
ohh thanks !!
for !d, all links are to docs.python.org, from what I know
!source
!d aiohttp
or from other docs
pip-specific ones
coolll
why does it output this link?
weird
this is aiohttp.structures not aiohttp
from what I understand
JS, C# and Python are most advanced for discord bots from what I know
all have async/await
Rust may join them
because no one writing bots wants to care about callbacks
Rust takes a lot of ideas not only C/Python
some Haskell stuff is also included
Rust is C with better composability
all the generic, memory safety, and other things can be derived from that
!d pathlib.Path.read_text
Path.read_text(encoding=None, errors=None)```
Return the decoded contents of the pointed-to file as a string:
```py
>>> p = Path('my_text_file')
>>> p.write_text('Text file contents')
18
>>> p.read_text()
'Text file contents'
``` The file is opened and then closed. The optional parameters have the same meaning as in [`open()`](https://docs.python.org/3/library/functions.html#open "open").
New in version 3.5.
aiohttp is a http library for asyncio
things like discord.py use aiohttp
it may have auto-threshold
if auto-threshold is unchangeable that's very bad
there are official docs on api
I had to use it to do the non-bot api
for web login
because it was genuinely better to do that myself instead of trusting a basically non-existent library
yes it is
they no longer develop it
now there's new team
from what I know
at least didn't go as Actix web
oh, my biggest file currently is exactly 1000 lines
well, they may have came back since I last checked
Source code: Lib/struct.py
This module converts between Python values and C structs represented as Python bytes objects. Compact format strings describe the intended conversions to/from Python values. The module’s functions and objects can be used for two largely distinct applications, data exchange with external sources (files or network connections), or data transfer between the Python application and the C layer.
not false
also: imagine getting lambdas in your language in 21st century (hi Java) when Algol 68 had them
I may misremember the year though
2014
!d lambda
An anonymous inline function consisting of a single expression which is evaluated when the function is called. The syntax to create a lambda function is lambda [parameters]: expression
Java 8 was released in March 2014 and introduced lambda expressions as its flagship feature.
"An anonymous inline function consisting of a single expression which is evaluated when the function is called." what dose it really means
anonymous
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
25
ohh i see
lambda itself does not get assigned a name during definition
!e
square = lambda x: x ** 2
print(square(5))
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
25
using this in python is against pep8 if I remember correctly
whereas in JS sometimes this is the preferred way
const square = (x) => (x * x);
(x) => (x * x) this one is lambda
- this is used a lot JS
- this makes function non-overwriteable
usually square would be an argument/a parameter not a variable
ChatGPT is a replicator not a solver
most of the actual important programming can't be solved with ChatGPT
if you can solve something with ChatGPT, your problem has been already solved by other people
true
if you're trying to solve something that's already been solved, then either you're doing it wrong or the previous solution isn't published enough
id does not solve issues
this is literally GPT
language model
it replicates
it does not solve
it's created to mimic human writing
core part of GPT is responsible to measure how likely it is that a certain text is written by a human
@verbal zenith
did it produce usage examples?
this is more or less what's required from actual good docs
same for tests
whereas comments are in most cases just either memes or apologies
##############
# add 1 to i #
##############
b *= 5
No im not working
i could hear
what is that
no
what did you said
i didn't get it
ok
java && python
i am 14 year old and still learning
nice
why is that so
ok
oh no it's spreading
minesweeper's happening
I don't remember either
it's mostly up for your choice
(it doesn't offend me in any way)
preferences are hard
(I have some, like, mental health conditions that prevent me from choosing)
Got it.
I'm thinking
(I heard as that the uncle said)
bye
step-by-step rewrite is sometimes better than risking a second system syndrome
or just feed the code into AI and ask it to rewrite
the list has been updated
it's not Aaron originally
someone just started calling me Aaron for some reason
Fuuun
"To be, or not to be?" We can't tell you, but we can Shakespeare-ify any sentence you can come up with! Check out our translator for hours (or minutes) of fun!
I've re-counted and it's 2MB of python code with 60K lines
that's roughly 1KB of code and 30 lines a day that survived to now
why do we have activities enabled here
no one can even join
Yea
(discord activity; I don't remember whether it requires Nitro to host)
I seee
@nova prawn https://testdriven.io/blog/django-async-views/
@nova prawn # model/media.py async def load_pictures(user_id: str): query = f""" SELECT * FROM pictures WHERE user_id = {user_id} """ result = run_query(query) ...
just add async should work
looks wrong
i'd expect there to beawait run_query(...)
or await asyncio.to_thread(run_query, ...)
GIL makes python more understandable in a lot of cases
@nova prawn is your program CPU-heavy?
what amount of CPU does it use?
2 gb vps
is the CPU usage the issue?
do you need to alternate between the asks or work on them totally in parallel?
its a microservice
why would you want to do this?
sad that on its own python doesn't have process a thing like Elixir has
if run_query takes time, then it's not enough to put async def to make it async
async def example():
time.sleep(1)
this will block
not familiar with this
(as a java developer)
these won't block
async def example():
await asyncio.sleep(1)
async def example():
await asyncio.to_thread(time.sleep, 1)
I'd expect Java to do it the same as C# where it does not thread (verb) by default
default for async?
@lapis cloud 👋
no just by default
ive heard all this huff from C# .NET being all fast because it does threading by default
it does have threading support
which, as a bonus, is easily convertible into async
you mean the other thing; the threading of LINQ
go's concurrency is on a another level.
too bad the language sucks
i can early get 8ms response times (per 8 cores, 200 req) and my servers wont be on fire
max like 30ms
go is just weird
"steampunk of programming languages" as Bryan Cantrill put it
it just sucks
your structs first charecter NEEDS TO BE CAPS if you want it to be exported
the hours i spent to find this out
there's also Elixir
im doing email sending
not sure if elixer is good for that
Elixir is good for very heavy concurrency requirements like telephony
i have experience with a lot of languages and i can confidently say i understand nothing
weird syntax
you can run them both on one core and on 128 cores
most correctly written applications will get proportional performance benefits
nice doxx
Tilia is a genus of about 30 species of trees or bushes, native throughout most of the temperate Northern Hemisphere. The tree is known as linden for the European species, and basswood for North American species. In Britain and Ireland they are commonly called lime trees, although they are not related to the citrus lime. The genus occurs in Euro...
hello
@rigid trellis @distant dragon 👋
hello
Took care of my brother’s dog while he was at Times Square
"only 1%"
is there a name for fallacy of saying "only 1% die, so 99% don't need it"?
Yes, It's called "It isn't my concern if it doesn't directly affect me."
what are you guys talking about
I meant, like, 2-4 word widely recognised name
Invincible Ignorance fallacy is the closest I could find
It is not so much a fallacious tactic in argument as it is a refusal to argue in the proper sense of the word.
australian? @winged shard
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
announcing RADIO THE UNIVERSE
planned 2020 winter release
https://twitter.com/sixesixesixe
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
Wishlist here:
https://store.steampowered.com/app/1053900/Radio_the_Unive...
@versed linden 👋
!voice
Voice verification
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
that's very much wrong and contradictory to iterative development
you must not need to store too much in your head while building anything
"good at communication"
questionable
concise
Brief, yet including all important information
bro its not about if shit matches the dictionary
its about how you make other people feel
6 seconds · Clipped by Alisa Feistel · Original video "Coming Of Age | Bryan Cantrill | Monktoberfest 2022" by RedMonk Tech Events
😂
i've been rejected twice cause i dont have a degree
but i have been accepted 10 times
then you have to have something to demonstrate your skills
in contrast to
waffle
(2.1) To speak or write evasively or vaguely.
(2.5) Often followed by on: to speak or write (something) at length without any clear aim or point; to ramble.
Highest salary for the Blender Foundation was 60,000EUR as of 2019
lowest was 32,500EUR
also OpenSolaris license
sure
I think @rugged tundra brings up a good point
I don't know what this guy is on about
As
Here
cmake_minimum_required(VERSION 3.21)
project(project_name_pls_change)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(MACOSX TRUE)
endif()
if(MACOSX)
include_directories(/usr/local/opt/libomp/include)
include_directories(/usr/local/include)
endif()
add_executable(project_name_pls_change main.cpp)
CMAKE? :What year is it?:
cd /project_root
ccmake .
make
well its a c++ app and cmake is kind of like the quasi standard of build systems
create a CMakeLists.txt file, @austere linden in the project root then run the above
From 2000s
theres a proposal for a standard build system
but cmake really isnt that bad and its by far better than any other c++ build system
.xkcd 927
doesnt apply, since its an iso standard
still applies
iso standard trumps a quasi standard
tell that to a middle manager
only for existing projects
iso standard just means you wrote up enough paperwork
im privileged enough that i dont have to ;D
ISO standards are nice and all, but try using them on, say, excel.
Which just emits confused screaming when you show it ISO-8601
Standards are great if and only if we can get a critical mass of people to actually use it
wtf how do you use cmake with excel
dude your workflow is kinda broken
but we were talking about cmake :/ and c++
last i checked you were talking about standards, but you do you
thinkpad gang
its 2008 some people here yonger
i need to make my self busy for a day, what program can i write with basic knowledge of python, i never used classes also, i wanna use them
A simple card game with a card class where you can fill a Deck (maybe even a deck class) and shuffle. You can then write a simple card game.
me when VS Code asks if I know the authors of a file
fr
"Do you trust the authors of this file?"
No. Not even remotely.
hi
Delphi pascal
no, then you'll have to wait two weeks in addition to the current requirements
@lunar haven why cant i speak
I need 50 messages as well. Does this include every chat within the discord or just to voice-chat-text groups?
Nvm. I read the answer
import random
from Eight_Ball_Answers import EightBallAnswers
int = random.randint(1, 8)
EightBallAnswers()
class EightBallAnswers:
if int == 1:
print("Yes")
elif int == 2:
print("No")
elif int == 3:
print("Maybe")
elif int == 4:
print("Posiibly")
elif int == 5:
print("Possibly Not")
elif int == 6:
print("Absolutly")
elif int == 7:
print("Aboslutly Not")
else:
print("Why would you ask that, you know the answer")
!e py import random choices = 'Apples', 'Pears', 'Oranges', 'Bananas' choice = random.choice(choices) print(choice)
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
Bananas
!e ```py
from dataclasses import dataclass
@dataclass
class Person:
name: str
age: int
people = [Person('Peter', 20), Person('Sally', 21)]
print(people)```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
[Person(name='Peter', age=20), Person(name='Sally', age=21)]
!e py description = {'apples': 'delicious', 'durians': 'stinky'} result = description['durians'] print(result)
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
stinky
programmed myself into a corner today,
think of it like i did it blocks, and all the blocks stacked around me but now i have to move data from every block into another room.. gonna take made hours of coding..
so i looked at it different, take all the blocks and just make one huge block with the data im processing then just take out what i need to the next room..
which came about of building a gui that accesses sensetive data so i broke it down, to only allow access to each block.. but then the blocks couldnt talk to eachother... its mad crazy security.. think i went a little to far on it with things that really werent security issues, more of what ifs.. that lead to another what if..
oo wat dis
!voice
Voice verification
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
@whole bear 👋
I have it currently as default thing on my github.io
https://timotheyca.github.io/
pure js
you can zoom in on the site
there are additional parameters but I don't remember how to configure them
it dynamically determines the depth
Provided to YouTube by iMusician Digital AG
Deadly Aminals · Scared Weird Little Guys
Enough Already
℗ 2010 John Fleming/Russell Berther
Released on: 2011-01-06
Auto-generated by YouTube.
if only I knew
I just iterate up to a certain (non-constant) depth and then map to an HSL colourspace
with the value that goes to generate the colour being relative to that same pre-render depth
depth is determined by lower-resolution renders
if it's an unpaid internship, it should at least provide a valuable experience
ehhhh I'm Canadian too
so, like, startups with people who don't know any better can't provide that
but it shouldn't be unpaid anyway
@wind raptor @somber heath
if you have an hour to spend watching a talk about that/adjacent topic, then you can watch this:
https://youtu.be/VzdVSMRu16g
Once upon a time, an investor proposed a "college replacement" by gathering up 18 year olds in order to give them money in exchange for future earnings. It was not a particularly thought through take, but it spurred this talk, which is a particularly thought through take. And heart-felt. And poignant.
the whole talk breaks down why this tweet is BS
can help me with django
what's the question?
I've heard of online courses that are "free" in exchange for a % of future earnings...and not even neccesarily in the same field.
return render(request, 'index.html')
from django.http import HttpResponse
from django.shortcuts import render
# Create your views here.
def hello(request):
return HttpResponse("<h1>Hello World</h1>")
def about(request):
return HttpResponse("About")
def index(request):
return render(request, 'index.html')
did you restart the server after you added the quotes?
what's the error now?
restart the server
in full
don't hope for auto-reload
error's output shows that the code is not updated
hard-restart the server
just compare to the previous error screenshot
it's not the same
so, now that the error is actually about TemplateDoesNotExist
it does not try to load from your directory
(((thought this, I'd expect, should do the thing)))
yes is there
I just explained why my previous suggestion might be irrelevant
i will do that
dacampos i was talking about somthing else
pathlib is better than os.path in almost every way
django can async
flask can't
@wind raptor I'd suggest not doing WSGI with Django
ASGI is preferred
you can't reliably store state in memory in Django anyway
for what?
cookiecutter is for project templating, from I understand
what
they both guarantee
cookiecutter build de itnerfaz
up to some point
mongo can have schema
optionally
MongoDB's stance on durability is:
your PostgreSQL isn't durable either
@molten bronze
"please stop spreading misinformation"
i udnerstand that
sql for transactions no sql for
big data is like json you can have with mongo db reapet data or you should handle very good
I have a database with transactions and without SQL
NoSQL does not mean no transactions
soo eveyone will use mongodb or why you should use sql isntead of MongoDB
"big data is like json"
I will put that on the wall
😄
so, the actual difference is not uniqueness or transactions
is more about what methods enforce that
with sql you can garantee that data will double duplicity will not exist soo for banks
you will sql and transactions
but mongodb for big data of other things
most NoSQL can provide the same
sometimes SQL is easier and stricter
depends on the task
function becomes a method on __get__
in python terms, method is a bound function
a result of function.__get__
!e
class C:
def m(self): ...
print(C.m)
print(C().m)
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | <function C.m at 0x7fd3785c8680>
002 | <bound method C.m of <__main__.C object at 0x7fd3783cc310>>
!e
class C:
@classmethod
def m(self): ...
print(C.m)
print(C().m)
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | <bound method C.m of <class '__main__.C'>>
002 | <bound method C.m of <class '__main__.C'>>
!e
class C:
@staticmethod
def m(self): ...
print(C.m)
print(C().m)
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | <function C.m at 0x7fb6c6df0680>
002 | <function C.m at 0x7fb6c6df0680>
I keep not understanding when to use mongo or postgresql or both u.u
sql i understend is more for transactions
no, it's for strict relational structure
less flexible
when that's needed
"Chuck Norris API"
www.chucknorrisfacts.com is mentioned here but I can't load it
https://meta.stackexchange.com/questions/9134/jon-skeet-facts
@honest field 👋
hiiiiiii. new here
!voice
Voice verification
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
!voice
I'm "quite satisfied" with my API design
object-oriented, inheritance-based
extra-cursed, in other words
i havent met yet the require number of messages 😢
1 2 3
1 2 3
3 1 2
2 3 1
I just realised it has an exponential complexity and I should probably limit that
1 2 3
1 2 3
1 2 3
there is fancy slicing
gonna bounce for now. my supervisor might see me lurking unto something else. hahahaha stay safe guys
join Maroloccio book club
(last time there was about figuring out numpy together)
I got this result
how are you solving it right now?
it's possible that you can turn it into a vectored form step-by-step
from just iteration
no
element-wise operations or ||broadcasting||
what does transpose do?
(answering that will help to find an easier solution)
@wind raptor
I can send you my solution if you're not interested in solving it yourself
sure
!e import numpy
@vocal basin :warning: Your 3.11 eval job has completed with return code 0.
[No output]
oh, wow
voice server died apparently
for some time
didn't check whether it changed
!e py import numpy as np a = np.arange(10).reshape(10, 1) b = np.arange(10).reshape(1, 10) arr = (a + b) % 10 print(arr)
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | [[0 1 2 3 4 5 6 7 8 9]
002 | [1 2 3 4 5 6 7 8 9 0]
003 | [2 3 4 5 6 7 8 9 0 1]
004 | [3 4 5 6 7 8 9 0 1 2]
005 | [4 5 6 7 8 9 0 1 2 3]
006 | [5 6 7 8 9 0 1 2 3 4]
007 | [6 7 8 9 0 1 2 3 4 5]
008 | [7 8 9 0 1 2 3 4 5 6]
009 | [8 9 0 1 2 3 4 5 6 7]
010 | [9 0 1 2 3 4 5 6 7 8]]
different result
you can use -1 in place of 10 in reshape
hello
# bot.py
import os
from discord import Intents
from discord.ext import commands
import discord
from dotenv import load_dotenv
intents = Intents.default()
intents.message_content = True
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
GUILD = os.getenv('DISCORD_GUILD')
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print(f'{client.user} has connected to Discord!')
client.run(TOKEN)
add default to getenv call
getenv has two signatures
if you have default as str, it will be get you str
@somber heath this is typechecker not interpreter arguing
os.getenv(key: str, default: T) returns str | T
load_dotenv does setenv calls
TOKEN = os.getenv('DISCORD_TOKEN')
if TOKEN is None:
raise ValueError('token not set')
Pylance will be fine with this
after this TOKEN will have type str
do this
it will fix it
correctly
exception ValueError```
Raised when an operation or function receives an argument that has the right type but an inappropriate value, and the situation is not described by a more precise exception such as [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
TOKEN type before if is str | None
after if it's guaranteed (as far as Pylance's concerned) to be str
Pylance's basic type checking is way stricter than PyCharm's default
depends on where you assign to a variable
(wait, is it "assign to" or just "assign"?)
# bot.py
import os
from discord import Intents
from discord.ext import commands
import discord
from dotenv import load_dotenv
intents = Intents.default()
intents.message_content = True
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
if TOKEN is None:
raise ValueError('token not set')
GUILD = os.getenv('DISCORD_GUILD')
client = discord.Client(intents=intents)
@client.event
async def on_ready():
for guild in client.guilds:
if guild.name == GUILD:
break
print(
f'{client.user} is connected to the following guild:\n'
f'{guild.name}(id: {guild.id})'
)
client.run(TOKEN)
there is the error on both guild's in the print statement at the bottom
what if client.guilds is empty?
for guild in client.guilds:
if guild.name == GUILD:
break
else:
return
on loops, else is ran when the loop exits without break/return
# bot.py
import os
from discord import Intents
from discord.ext import commands
import discord
from dotenv import load_dotenv
intents = Intents.default()
intents.message_content = True
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
if TOKEN is None:
raise ValueError('token not set')
GUILD = os.getenv('DISCORD_GUILD')
client = discord.Client(intents=intents)
@client.event
async def on_ready():
for guild in client.guilds:
if guild.name == GUILD:
break
else:
return
print(
f'{client.user} is connected to the following guild:\n'
f'{guild.name}(id: {guild.id})'
)
members = '\n - '.join([member.name for member in guild.members])
print(f'Guild Members:\n - {members}')
client.run(TOKEN)
it keeps saying guild in guild.members is not defined
missing tab
@client.event
async def on_ready():
for guild in client.guilds:
if guild.name == GUILD:
break
else:
return
print(
f'{client.user} is connected to the following guild:\n'
f'{guild.name}(id: {guild.id})'
)
members = '\n - '.join([member.name for member in guild.members])
print(f'Guild Members:\n - {members}')
missing guilds/members intents or something
while you're developing, you can use intents = Intents.all() for simplicity
same as intents.message_content = True, there is something for member list
if you need additional help, use #discord-bots or #1035199133436354600
im just here to observe as i know nothing.
#pysimplegui code
#Layout 1
Layout1 = [
[sg.Text('Welcome to PySimpleGUI!')],
[sg.Button("Click me")],
[sg.Image("statistik.png", key="IMG")],
[sg.Button('Close view')],
]
graph = "bigballs.png"
w = sg.window("statistik", Layout1)
while True:
event, values = w.read()
if event == sg.WIN_CLOSED or event == 'Close view':
break
elif event == 'Click me':
if graph == 'big balls.png':
w['img'].update("big balls2.png")
graph = 'big balls2.png'
else:
if graph == 'big balls2.png':
w['img'].update('big balls.png')
graph = 'big balls.png'
if event == sg.WIN_CLOSED or event == 'Close view':
break
w.close()```
the pngs are not images of testicles
so the problem was (sg.Window)?
ywp
while True:
event, values = w.read()
if event == sg.WIN_CLOSED or event == 'Close view':
break
elif event == 'Switch image':
if graph == 'big balls.png':
w['img'].update("big balls2.png")
graph = 'big balls2.png'
else:
if graph == 'big balls2.png':
w['img'].update('big balls.png')
graph = 'big balls.png'
if event == sg.WIN_CLOSED or event == 'Close view':
break
w.close()
making a web API so I can monitor asyncio tasks running in my program
currently, on per-method basis
is elif a joint of else and if?
yes
else if
a joint
just like i need a joint rn, blaze it mlg style
if a:
...
elif b:
...
else:
...
if a:
...
else:
if b:
...
else:
...
elif serves to reduce nesting
so I can get simple output like this:
{
"module.Class().method": {
"Count": 1618,
"Concurrency": 2
},
"package.module.Class.method": {
"Count": 5,
"Concurrency": 1
},
"time": 1672749920.180879
}
with simple requests like this:
{
type: "*",
idkey: "target",
idbase: {
type: "*",
requests: {
Count: {},
Concurrency: {},
},
},
operator: null,
requests: {
"module.Class().method": {},
"package.module.Class.method": {},
},
catches: { "not an operator": null, "*": null },
time: null,
}
trying to get my current API gateway to swap targets and instrumentation types sounds fun
(so they are grouped on Count/Concurrency on the outer layer)
#pysimplegui code
#Layout 1
Layout1 = [
[sg.Text('Welcome to PySimpleGUI!')],
[sg.Button("Switch image")],
[sg.Image("big balls.png", key="IMG")],
[sg.Button('Close view')],
]
w = sg.Window("statistik", Layout1)
graph = "bigballs.png"
while True:
event, values = w.read()
if event == sg.WIN_CLOSED or event == 'Close view':
break
elif event == 'Switch image':
if graph == 'big balls.png':
w['img'].update("big balls2.png")
graph = 'big balls2.png'
else:
if graph == 'big balls2.png':
w['img'].update('big balls.png')
graph = 'big balls.png'
if event == sg.WIN_CLOSED or event == 'Close view':
break
w.close()``` the issue this time is that its not swtiching between images
why is this second if
isn't the first if doing the same enough?
nah
@worthy token 👋
you don't change event here
hai
huh?
I cant talk to you guiz
you already checked event == sg.WIN_CLOSED or event == 'Close view'
in the else clause it's already guaranteed to be False
so the second if event == sg.WIN_CLOSED or event == 'Close view': never works
removing it won't change anything
because it already does nothing
hi id talk but im echoing through someone
ye thats what i thought. removed it but i still cant change between images
shouldn't it be IMG not img?
!voice
Voice verification
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
@somber heath Yes
"should know know when to die" is quite applicable to processes/systems
changes nothing
"play minesweeper
play minesweeper even more"
😦 u will poweer through, u got this
there is a very weird statistical moment with my ranking
out of all 10 parameters that affect standing, I have ranking by that specific parameter higher than the overall ranking in only 1 or 2 parameters
so I am good at one category and garbage at everything else
What would the opposing idiom be for "Negative Nancy"? "Positive Peter"?
i guess
"Optimistic Owen"?
just saying id stew that thing if i saw it
"don't get irritated trying, just give up"
if you drive a ford you a "insert ford-specific slur"
apparently, I muted someone just in time
if it was me , then im offended
the suspense is unreal
That horse is my spirit animal
I'm not sure I have a formed opinion.
had had to use some bash scripts earlier but moved on to solutions that don't require writing a lot of it
Hey @robust lichen!
It looks like you tried to attach file type(s) that we do not allow (.sh). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.
Feel free to ask in #community-meta if you think this is a mistake.
mostly writing Dockerfile/docker-compose.yml and using exactly one bash command
docker compose up -d --build
optionally with clear && at the start
use the command that gives it
!paste
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.pythondiscord.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.
if you need comments in bash scripts, you're either doing it wrong or using obscure functionality xargs-alike
or just "if you need comments, you're doing it wrong" in general
I see sed there
no awk though
awk is great; never used it
bash allows writing function, afaik
comments don't improve readability
there are two types of comments mixed
one explains sed
another is useless
this is a bad way to describe what code does as it adds/explains nothing
and if it is it will set the variable to 1
you can literally look at then end of the line to see episode_number=1
there is a better way to express that
if there is only one episode, then select it
"I can judge code I can't see
I can say it's bad and I'll be right in the median case"
Yo
No mic since I'm still not back in my office
I miss it
A lot
Depends on the day
I don't mind my co-workers
Yeah, I lucked out
I've certainly had shit ones in the past, but I like the folks here
Same
I think today, I'd rather be gaming
is this code i wrote bad?
def search_movies(self):
try:
query = input("[+] Enter a show name: ")
json_data = self.get_json_data(query)
strings = [
f'{e["id"]}\t{e["title"]} ({e["type"]})' for e in json_data["results"]
]
output = self.fzf.prompt(strings, "--border -1 --reverse --with-nth 2..")
[id, name] = output[0].split("\t")
return id, name
except IndexError:
print(f"{warn}No results found")
sys.exit()
def main():
movie_client = MovieClient()
id, name = movie_client.search_movies()
result = watch_movie(id, name)
media_link = [f'{p["url"]} {p["quality"]}' for p in result["sources"]]
subtitles = [f'{z["url"]} {z["lang"]}' for z in result["subtitles"]]
qualities = [p["quality"] for p in result["sources"]]
best_quality = choose_best_quality(qualities)
for link in media_link:
if best_quality in link:
link = link.split()[0]
print("[+] Press Ctrl+C to exit the program")
result = subprocess.run(
["mpv", f"{link}", f"--title={name.split()[0]}"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
if __name__ == "__main__":
main()
yes you assign to id
strings -- name too abstract
formatted_results?
if in the original it was "results"
@hallow oxide
?
@winged hinge if it does SystemExit inside on error, it can be considered an ok handling
it shouldn't be done this way but anyway
?
forgot to add 👋?
I meant to have a 👋 after that. I thought I did one.
@winged hinge main shouldn't return generally
shouldn't return a value at least
system code return is not a very pythonic way
Hai Opal
def choose_best_quality(qualities):
ordered_qualities = ["1080", "720", "480", "360", "240", "auto"]
for quality in ordered_qualities:
if quality in qualities:
return quality
return qualities[0]
what was that meme
like "I show people the way to <something> I can't have myself"
that's what the quality function would say
No mic, still in the business services hall
def search_movies(self):
try:
query = input("[+] Enter a show name: ")
json_data = self.get_json_data(query)
strings = [
f'{e["id"]}\t{e["title"]} ({e["type"]})' for e in json_data["results"]
]
output = self.fzf.prompt(strings, "--border -1 --reverse --with-nth 2..")
[id, name] = output[0].split("\t")
return id, name
except IndexError:
print(f"{warn}No results found")
sys.exit()
That's going to be an issue, too
Since that's pointing to the function id
(I've mistranslated a misremembered mistranslated meme)
why like that?
This is just a guess. That way you're at least sending some content, and as you test their connection you can then go to the bigger one
In situ
En situ?
Whatever
@zenith radish Am I close?
or like, ordered by how needed would they be; may be some weird order like 1080p, 360p, 720p, 480p, 4K, 1440p
Gotcha
24p
1p
80x24 for tty or something
Flight plans
If that
or, like, not Linux but DOS
There's still planes out there where you still have to load in the flight plans and stuff via floppy disks
...oh great...
Eh, if it works it works
Are the disks new?
And now I'm just imagine someone doing exercises but instead of weights they're just curling parrots
Wouldn't matter if they're being written to on the regular
The only quality drop is from them not being written to
Bit rot
"newly scavenged"
Well they certainly don't use the crank to open and close the window to a plane....
Arch on microwave next?
I use marijuana, btw
If memory serves
Android, I would think, Duke
there are architecture specifics even for Java iirc
also may still depend on external programs
yus
til
yes smart fridges do have an OS
wassup guys i have a small little question
Ubuntu as a version specific for IoT -LP
This
like, if you call ifconfig from the program, good luck porting that
"smart"only i guess
@rugged tundra They just couldn't keep up with Third party support
They came too late to the party
so if you do CORS on a website , my users can still send requests from the developer tools
how do i prevent this?
And they were fighting an uphill battle
Pitney-Bowes mail machines use Windows
@rugged root can I get permission to share my screen? you can have my word that I am not gonna dissapoint the server.
I wanna share my terminal and maybe sometimes nvim/tmux
!stream 406382478102626314
✅ @winged hinge can now stream until <t:1672758303:f>.
Or maybe my linux rice
has anyone seen Ubuntu Docker image's list of supported architectures?
I failed to identify two of them
thanks @rugged root
whats wrong with dwm
Again, LP said that a LOT of things use some sort of Windows
Xmonad on top
"Ricing" as in trying to make things super like tip top
You can restrict what commands/requests actually do anything
Using tokens and what have you
@sour willow
userbotting is banned
Yes
but userbotting via applications is fine
xmonad is bad
wtf
Bot and User accounts have different access for Discord, @rugged tundra, for example
"userbotting" in quotes
No drivers
ChromeOS
Sorry
Wait
What?
True
I can do a class example after I finish my time sheets
One of my favorite things to teach
@topaz mantle 👋
@rugged tundra There's GDScript. LP beat me to it
GDScript is their built in scripting language
@robust lichen Don't be demanding
God this is why I miss being able to speak
So much more efficient than me trying to keep up via typing
I don't know how LX does it
I did the survey.
Rate limiting is common
And not a bad way of handling excessive amounts of requests
BUT you're still getting those
Hey Pablo
What's up
this is a meme video on linux I made a year back
https://www.youtube.com/watch?v=3ia42UkRUHI
My Last S H I T P O S T
===========x Rant x===========
I love to make videos about linux,cloud,development etc.
If you are not happy single, you wont be happy in a relationship. True happiness comes from using LINUX, not another person. Start using LINUX.
And please Subscribe to my channel. Hit the like button to trigger the youtube algorith...
today I fixed a possibility of an exponential attack on my API gateway
Henlo @stray niche
in other words, I shouldn't have been implementing it myself in the first place
Where are you the whole day
Ahhhh
Henlo
Mars*
(ppc64le and s390x were kind of unexpected for me)
How much elon asking for one round of trip to mars?
Don't know enough about Django to be of any use, sorry
@ripe raptor Sorry bud
#web-development Would
Also a good movie
@zenith radish Been missin' you, bud
Miss you too bb ❤️
@ripe raptor They may not be used as often, but the quality is usually much higher
The folks there know their shit. Or the regular help system
I just know that I personally don't know jack
❤️
can i stream ?
For which file - no, bad @zenith radish - exactly, Pablo?
?
Give me a sec, need to make more progress on my time sheets
I know enough Django for my practical use
my practical use being avoiding Django for valid reasons
@rugged root you also have to submit time sheets in your office?
hemlock can i stream?
I really hated when I had to submit in my last company
Patience. Like I said, I want to get my timesheets knocked out first
I'm already running behind
All good
It's not overly clear
The cost of typing
God I miss having my office...
Currently having to be camped out in one of our conference rooms in the business services hall
Can't use the speaky words without disrupting people
Good!
I figured an example can get you going
It irritates me that the Windows calc doesn't have anything for accounting
That feels like a no brainer
"just to make you buy Excel"
It's going to make me use one of our tape calcs here at the office
WSGI stuff does not do good with background tasks
from what I remember
if you call via request then fine-ish
There's always ASGI
