This commit adds the Stringer method representation into the repository.
The Rich struct of package text now implements Stringer and returns the
Content in plain text.
Prior to the repository commits, Rich used to have String().
Prior to this commit, the Mentioned method in MessageCreate didn't
return anything. This is a regression. It now returns a boolean that
indicates mentioned.
This commit adds the Avatar method into the Author interface. It returns
the URL if one, or it can return an empty string if either the service
does not support avatars or the user doesn't have avatars.
Prior to this commit, interface Author embedded interface Namer. This
doesn't work, as it is discouraged to keep a working state inside the
implementation of Author, but Namer's embedded Iconer requires a state.
The commit changed Author to use a Name method instead, which is only a
getter. It will no longer satisfy interface Name.
This commit fixes IconContainer's SetIcon, which was SetImage prior to
this commit. Before the code generation commits, this container
originally had SetIcon.
This commit also adds back ImageContainer, which was a regression during
the code generation changes. It has the SetImage method.
This commit regenerates package text to use asserters instead of
manually asserting structs. This is to both bring consistency to the
interfaces and prepare it for the incoming IPC additions.
This commit also changed the Colorer interface to require returning a
32-bit RGBA color. Before, backends could return 24-bit RGB OR 32-bit
RGBA, but there wasn't a good way to distinguish between the two. Now,
backends must set the alpha bits to 0xFF if it's 24-bit only.
This package adds the code generation for package empty, which provides
structs that has no-op asserter methods for ease of use.
The package demonstrates one of the many possible use cases of having a
repository ready for code generation.
This commit fixes some trivial errors in the repository package. The
changes are breaking.
This commit also replaced the old cchat and text Go source code files
with ones generated straight from the repository. To regenerate, run
go generate ./...
The code is generated using the Jennifer library. In the future, all
generated code (including package empty and the RPC library) will use
Jennifer.
This commit adds a new package repository containing every single cchat
types that the package provides. Its goal is to be the source of truth
for the cchat files to be generated from.
A huge advantage of this is having types in an easily representable
format. This means that other languages can easily parse the repository
and generate its own types that are similar to the original ones.
Having a repository also allows easier code generation. For example,
this commit will allow generating the "empty" package in the future,
which would contain empty implementations of cchat databases that would
return nil for asserter methods.